title: SwiftUI Localization - how to make the UI component and its function the base for localization
body: <p>I followed the recommended way on how to localize an iOS app—I use Base localization with English set as the development language.</p>
  <p>So I have a structure like this:</p>
  <pre><code>Localizable.strings
  |___ Localizable.strings (English)
  |___ Localizable.strings (German)
  ...
  </code></pre>
  <p>and now when I use something like <code>Text(&quot;Cancel&quot;)</code> I will get the following in the <code>Localizable.strings (German)</code>:</p>
  <pre><code>/* No comment provided by engineer. */
  &quot;Cancel&quot; = &quot;Abbrechen&quot;;
  </code></pre>
  <p>Then I looked at the localization files that Facebook uses in their bundle (<code>Facebook Login</code> library) and they look like this:</p>
  <pre><code>&quot;ErrorRecovery.Cancel&quot; = &quot;Abbrechen&quot;;
  </code></pre>
  <p>Any idea how can I achieve that without getting <code>ErrorRecovery.Cancel</code> rendered when the user switches the app language to <code>English</code> (which is the development language)?</p>
  <p>This would be more desirable for me, because the base itself could be used as an ID across different platform (e.g. if I wanted to also localized my Android app). Also, sometimes the same word in one language doesn't always translate to the same word in another language e.g. <code>Search</code> could have the meanings: <code>to search</code> and <code>the search engine</code> or the <code>the process of searching</code>, which in German could be translated to <code>Suchen</code> for the former and <code>Suche</code> for the latter. In that case <code>Text(&quot;Search&quot;)</code> wouldn't be sufficient to cover those cases. I know that I could use <code>NSLocalizedString(&quot;Search&quot;, comment: &quot;verb&quot;)</code> and <code>NSLocalizedString(&quot;Search&quot;, comment: &quot;the process of searching&quot;)</code>, but then the ID of a localization entry would be composed of the <code>string</code> and <code>comment</code>.</p>