<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>localisation xcode &#8211; swiftyplace</title>
	<atom:link href="https://www.swiftyplace.com/blog/tag/localisation-xcode/feed" rel="self" type="application/rss+xml" />
	<link>https://www.swiftyplace.com</link>
	<description>Learn how to build amazing apps with SwiftUI and Combine</description>
	<lastBuildDate>Tue, 09 Jan 2024 16:42:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.swiftyplace.com/wp-content/uploads/2023/08/cropped-logo-1-32x32.png</url>
	<title>localisation xcode &#8211; swiftyplace</title>
	<link>https://www.swiftyplace.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to translate and localize iOS app with string catalogs in Xcode 15</title>
		<link>https://www.swiftyplace.com/blog/localization-ios-app-xcode-15?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=localization-ios-app-xcode-15</link>
					<comments>https://www.swiftyplace.com/blog/localization-ios-app-xcode-15#comments</comments>
		
		<dc:creator><![CDATA[Karin Prater]]></dc:creator>
		<pubDate>Tue, 19 Sep 2023 09:19:02 +0000</pubDate>
				<category><![CDATA[iOS app development]]></category>
		<category><![CDATA[localisation xcode]]></category>
		<category><![CDATA[localise ios app]]></category>
		<category><![CDATA[swift localise]]></category>
		<category><![CDATA[translate app swift]]></category>
		<category><![CDATA[translating iOS app]]></category>
		<guid isPermaLink="false">https://www.swiftyplace.com/?p=2353</guid>

					<description><![CDATA[<p>It is now much easier to localise your iOS apps with Xcode 15 and string catalogs. Learn how to translate your strings in SwiftUI.</p>
<p>The post <a rel="nofollow" href="https://www.swiftyplace.com/blog/localization-ios-app-xcode-15">How to translate and localize iOS app with string catalogs in Xcode 15</a> appeared first on <a rel="nofollow" href="https://www.swiftyplace.com">swiftyplace</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Managing the localization and translation of an app’s string resources can be a challenging task. However, with the introduction of Xcode 15 and string catalogs, it has become much easier to localize iOS apps. In this blog post, I will show you how to work with the new string catalog and convert an existing project to utilize this feature.</p>



<p>In the past, managing strings used to be difficult with the localizable strings file. But now, the new string catalogs are based on the same file, which is great because it means <strong>you can use string catalogs for projects that support older iOS versions</strong> as well. This is a significant advantage, as it allows you to move forward without being held back, even if you still support older iOS versions.</p>



<p>One of the main advantages of using string catalogs is that it automatically tracks all the strings in your project. This eliminates the need to manually collect and manage strings, making the localization process much more efficient. Additionally, Xcode provides a progress indicator to motivate you and show how much work is still remaining.</p>



<p>Overall, using string catalogs in Xcode 15 greatly simplifies the localization and translation process for iOS apps. It provides a centralized and efficient way to manage all the string resources in your project, making it easier to maintain and update translations. By utilizing this feature, you can ensure a seamless user experience for your app’s international audience.</p>



<p>Note that I am not covering localisation of Date types in this post. You can read about it in this post <a href="https://www.swiftyplace.com/blog/swift-date-formatting-10-steps-guide">Swift Date Formatting: 10 Steps Guide.</a></p>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2b07.png" alt="⬇" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Download the example files from my <a href="https://github.com/gahntpo/LocalizationProject" target="_blank" rel="noopener">Github</a></p>



<div style="height:46px" aria-hidden="true" class="wp-block-spacer"></div>



			
			
										
			
			


<div style="height:59px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">How to add string catalog to your Xcode project</h2>



<p>If you have a new project, add a new file and choose &#8220;String Catalog&#8221;. Xcode will ask you for a file name, keep the default &#8220;Localizable&#8221; name.&nbsp;</p>



<figure class="wp-block-image"><img decoding="async" src="https://www.swiftyplace.com/wp-content/uploads/2023/09/create-string-catalog-xcode-1024x694.webp" alt=""/></figure>



<div style="height:21px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Xcode will create a new file &#8220;Localizable.xcstrings&#8221;. Initially, your string catalog will be empty. <b>You need to build and run your project. </b>This will cause Xcode to search your files and collect all string resources into your string catalog.&nbsp;</p>



<div style="height:44px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">How do add more languages for localisation?</h3>



<p>Xcode will by default create a string catalog with the base localization in English. If you want to add more languages, simply click the &#8220;plus&#8221; button in the xcstrings file and select the language.&nbsp;</p>



<figure class="wp-block-image"><img decoding="async" src="https://www.swiftyplace.com/wp-content/uploads/2023/09/add-languages-string-catalog-xcode-1024x647.webp" alt="add additional languages to string catalog in xcoe"/></figure>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image"><img decoding="async" src="https://www.swiftyplace.com/wp-content/uploads/2023/09/Xcode-localization-settings-1-1024x689.webp" alt="Xcode 15 settings for localisation"/><figcaption class="wp-element-caption">Xcode 15 automatically adds localisation settings for you projects when you add string catalogs with multiple languages.</figcaption></figure>



<div style="height:43px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Migrating an existing project to string catalogs</h3>



<p>Right-click on the &#8220;Localaiable.strings&#8221; file and select &#8220;Migrate to String Catalog&#8221;. Xcode will show you a dialog to select which files to migrate. Click on &#8220;Translate&#8221;. Xcode will that remove the old &#8220;strings&#8221; type and add a new string catalog. Migration can take a few seconds depending on your project size. It uses all the values from your previous strings file and collects all your translations.</p>



<p>Additionally, it will collect strings from your project e.g. SwiftUI views. This is great as you will see what strings you have missed so far and can add translations.</p>



<figure class="wp-block-image"><img decoding="async" src="https://www.swiftyplace.com/wp-content/uploads/2023/09/migrate-string-catalog-xcode-1024x866.webp" alt=""/></figure>



<div style="height:49px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">How do you localise a string inside the iOS info plist file?</h3>



<p>You might want to translate entries in your info plist files. This is not included in the default&nbsp;&#8220;Localizable.xcstrings&#8221; file. You need to create a dedicated string catalog&nbsp;and name it &#8220;InfoPlist&#8221;.</p>



<figure class="wp-block-image"><img decoding="async" src="https://www.swiftyplace.com/wp-content/uploads/2023/09/add-string-catalog-infoplist-1024x721.webp" alt=""/></figure>



<div style="height:21px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Once you build and run your project, you will see all the entries form the info plist file.</p>



<figure class="wp-block-image"><img decoding="async" src="https://www.swiftyplace.com/wp-content/uploads/2023/09/string-catalog-infoplist.webp" alt=""/></figure>



<div style="height:46px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">How to use multiple string catalog files when my project gets too big?</h3>



<p>If your project gets too big and it is hard to keep track of all your string rescues in one file, you can add additional string catalogs. Create a new string catalog file and name it e.g. &#8220;Extra&#8221;. In code, you need to specify which table Xcode should add it. Use the&nbsp;<b>LocalizedStringResource</b> with the table and pass the string catalog name.</p>



<p>Additionally, you can specify a comment. This is useful if you want to send your string files to an external translator and want to give more context on how and where these strings are used. This might improve the translation quality.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono-NL.ttf" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="struct ContentView: View {
    var body: some View {
        VStack {
            Text(LocalizedStringResource(&quot;This string will be added to the extra string cataloge&quot;,
                                         table: &quot;Extra&quot;))

            Text(&quot;Finish&quot;,
                 table: &quot;Extra&quot;,
                 comment: &quot;this is the button to finish a note, that is in the toolbar&quot;)
        }
    }
}" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F286C4">struct</span><span style="color: #F6F6F4"> </span><span style="color: #97E1F1; font-style: italic">ContentView</span><span style="color: #F6F6F4">: View {</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #F286C4">var</span><span style="color: #F6F6F4"> body: </span><span style="color: #F286C4">some</span><span style="color: #F6F6F4"> View {</span></span>
<span class="line"><span style="color: #F6F6F4">        VStack {</span></span>
<span class="line"><span style="color: #F6F6F4">            </span><span style="color: #97E1F1">Text</span><span style="color: #F6F6F4">(</span><span style="color: #97E1F1">LocalizedStringResource</span><span style="color: #F6F6F4">(</span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">This string will be added to the extra string cataloge</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">,</span></span>
<span class="line"><span style="color: #F6F6F4">                                         </span><span style="color: #97E1F1">table</span><span style="color: #F6F6F4">: </span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">Extra</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">))</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">            </span><span style="color: #97E1F1">Text</span><span style="color: #F6F6F4">(</span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">Finish</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">,</span></span>
<span class="line"><span style="color: #F6F6F4">                 </span><span style="color: #97E1F1">table</span><span style="color: #F6F6F4">: </span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">Extra</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">,</span></span>
<span class="line"><span style="color: #F6F6F4">                 </span><span style="color: #97E1F1">comment</span><span style="color: #F6F6F4">: </span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">this is the button to finish a note, that is in the toolbar</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">)</span></span>
<span class="line"><span style="color: #F6F6F4">        }</span></span>
<span class="line"><span style="color: #F6F6F4">    }</span></span>
<span class="line"><span style="color: #F6F6F4">}</span></span></code></pre></div>



<div style="height:24px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image"><img decoding="async" src="https://www.swiftyplace.com/wp-content/uploads/2023/09/mulitpli-string-catalog.webp" alt="working with multiple string catalog files in Xcode"/></figure>



<div style="height:45px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Keeping track of your translations with string catalogs</h2>



<p>Xcode tracks your translation progress. Next to each language you can see how much of your strings are translated in percentage. This is great to keep you focused on the task. It shows all entries that are translated successfully (have a green checkmark).</p>


<div class="wp-block-image">
<figure class="aligncenter"><img decoding="async" src="https://www.swiftyplace.com/wp-content/uploads/2023/09/string-catalog-xcode-multiple-langages.webp" alt="Xcode string catalogs show progress of translations"/></figure>
</div>


<div style="height:23px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Xcode assigns a state to each entry. Here is what each of them mean:</p>



<ul class="wp-block-list">
<li><strong>STALE</strong>: the string is no longer used in code (you probably deleted it recently).&nbsp;</li>



<li><strong>NEW</strong>: this is a new entry that you need to add translations to</li>



<li><strong>NEEDS REVIEW</strong>: you can mark entries for review.</li>



<li><strong>Green Checkmark</strong>: the entry is translated</li>
</ul>



<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">How do I use localized strings in SwiftUI?</h2>



<p>SwiftUI makes it very easy to localise your apps. Every time you use a Text view and pass a text as a localizable resource, Xcode will add it to your string catalog.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono-NL.ttf" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack {
            Text(&quot;This will be localized&quot;)

            Text(verbatim: &quot;This will not be localized&quot;)
            Text(String(&quot;This will also not be localized&quot;))
        }
    }
}
" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F286C4">import</span><span style="color: #F6F6F4"> </span><span style="color: #97E1F1; font-style: italic">SwiftUI</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F286C4">struct</span><span style="color: #F6F6F4"> </span><span style="color: #97E1F1; font-style: italic">ContentView</span><span style="color: #F6F6F4">: View {</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #F286C4">var</span><span style="color: #F6F6F4"> body: </span><span style="color: #F286C4">some</span><span style="color: #F6F6F4"> View {</span></span>
<span class="line"><span style="color: #F6F6F4">        VStack {</span></span>
<span class="line"><span style="color: #F6F6F4">            </span><span style="color: #97E1F1">Text</span><span style="color: #F6F6F4">(</span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">This will be localized</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">            </span><span style="color: #97E1F1">Text</span><span style="color: #F6F6F4">(</span><span style="color: #97E1F1">verbatim</span><span style="color: #F6F6F4">: </span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">This will not be localized</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">)</span></span>
<span class="line"><span style="color: #F6F6F4">            </span><span style="color: #97E1F1">Text</span><span style="color: #F6F6F4">(</span><span style="color: #97E1F1; font-style: italic">String</span><span style="color: #F6F6F4">(</span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">This will also not be localized</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">))</span></span>
<span class="line"><span style="color: #F6F6F4">        }</span></span>
<span class="line"><span style="color: #F6F6F4">    }</span></span>
<span class="line"><span style="color: #F6F6F4">}</span></span>
<span class="line"></span></code></pre></div>



<div style="height:19px" aria-hidden="true" class="wp-block-spacer"></div>



<p>That is because SwiftUI Text pass its argument as a localizable type e.g. <b>LocalizedStringKey</b></p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono-NL.ttf" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="Text(
    _ key: LocalizedStringKey,
    tableName: String? = nil,
    bundle: Bundle? = nil,
    comment: StaticString? = nil
)" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #97E1F1">Text</span><span style="color: #F6F6F4">(</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #BF9EEE">_</span><span style="color: #F6F6F4"> key</span><span style="color: #F286C4">:</span><span style="color: #F6F6F4"> LocalizedStringKey,</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #97E1F1">tableName</span><span style="color: #F6F6F4">: </span><span style="color: #97E1F1; font-style: italic">String</span><span style="color: #F286C4">?</span><span style="color: #F6F6F4"> </span><span style="color: #F286C4">=</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">nil</span><span style="color: #F6F6F4">,</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #97E1F1">bundle</span><span style="color: #F6F6F4">: Bundle</span><span style="color: #F286C4">?</span><span style="color: #F6F6F4"> </span><span style="color: #F286C4">=</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">nil</span><span style="color: #F6F6F4">,</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #97E1F1">comment</span><span style="color: #F6F6F4">: </span><span style="color: #97E1F1; font-style: italic">StaticString</span><span style="color: #F286C4">?</span><span style="color: #F6F6F4"> </span><span style="color: #F286C4">=</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">nil</span></span>
<span class="line"><span style="color: #F6F6F4">)</span></span></code></pre></div>



<div style="height:19px" aria-hidden="true" class="wp-block-spacer"></div>



<p>When you define a property or function in your SwiftUI views, make sure to use either&nbsp;<b style="font-family: var( --e-global-typography-text-font-family ), Sans-serif; font-size: 1rem;">LocalizedStringKey </b>or <strong>LocalizedStringResource. </strong>If you use String type, they will not be added to string catatog.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono-NL.ttf" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack {
            Text(title())

            TitleView(text: &quot;Will this be localized&quot;)
        }
    }

    func title() -&gt; LocalizedStringKey {
        return &quot;localize this text&quot;
    }
}

struct TitleView: View {
    let text: LocalizedStringKey // or LocalizedStringResource

    var body: some View {
        Text(text)
            .foregroundStyle(.pink)
    }
}" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F286C4">import</span><span style="color: #F6F6F4"> </span><span style="color: #97E1F1; font-style: italic">SwiftUI</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F286C4">struct</span><span style="color: #F6F6F4"> </span><span style="color: #97E1F1; font-style: italic">ContentView</span><span style="color: #F6F6F4">: View {</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #F286C4">var</span><span style="color: #F6F6F4"> body: </span><span style="color: #F286C4">some</span><span style="color: #F6F6F4"> View {</span></span>
<span class="line"><span style="color: #F6F6F4">        VStack {</span></span>
<span class="line"><span style="color: #F6F6F4">            </span><span style="color: #97E1F1">Text</span><span style="color: #F6F6F4">(</span><span style="color: #97E1F1">title</span><span style="color: #F6F6F4">())</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">            </span><span style="color: #97E1F1">TitleView</span><span style="color: #F6F6F4">(</span><span style="color: #97E1F1">text</span><span style="color: #F6F6F4">: </span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">Will this be localized</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">)</span></span>
<span class="line"><span style="color: #F6F6F4">        }</span></span>
<span class="line"><span style="color: #F6F6F4">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #F286C4">func</span><span style="color: #F6F6F4"> </span><span style="color: #62E884">title</span><span style="color: #F6F6F4">() </span><span style="color: #F286C4">-&gt;</span><span style="color: #F6F6F4"> LocalizedStringKey {</span></span>
<span class="line"><span style="color: #F6F6F4">        </span><span style="color: #F286C4">return</span><span style="color: #F6F6F4"> </span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">localize this text</span><span style="color: #DEE492">&quot;</span></span>
<span class="line"><span style="color: #F6F6F4">    }</span></span>
<span class="line"><span style="color: #F6F6F4">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F286C4">struct</span><span style="color: #F6F6F4"> </span><span style="color: #97E1F1; font-style: italic">TitleView</span><span style="color: #F6F6F4">: View {</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #F286C4">let</span><span style="color: #F6F6F4"> text: LocalizedStringKey </span><span style="color: #7B7F8B">// or LocalizedStringResource</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">    var body: </span><span style="color: #F286C4">some</span><span style="color: #F6F6F4"> View {</span></span>
<span class="line"><span style="color: #F6F6F4">        </span><span style="color: #97E1F1">Text</span><span style="color: #F6F6F4">(text)</span></span>
<span class="line"><span style="color: #F6F6F4">            .</span><span style="color: #97E1F1">foregroundStyle</span><span style="color: #F6F6F4">(.pink)</span></span>
<span class="line"><span style="color: #F6F6F4">    }</span></span>
<span class="line"><span style="color: #F6F6F4">}</span></span></code></pre></div>



<div style="height:21px" aria-hidden="true" class="wp-block-spacer"></div>


<div class="gb-container gb-container-c5dedc2e">
<div class="gb-container gb-container-f7a433c7">
<div class="gb-container gb-container-7a8dc7a3">

<figure class="gb-block-image gb-block-image-f04fbbad"><a href="https://www.swiftyplace.com/free-swiftui-layout-cookbook" target="_blank" rel="noopener noreferrer"><img fetchpriority="high" decoding="async" width="640" height="500" class="gb-image gb-image-f04fbbad" src="http://www.swiftyplace.com/wp-content/uploads/2024/01/swiftui_roadmap_preview.webp" alt="swiftui roadmap " title="swiftui_roadmap_preview" srcset="https://www.swiftyplace.com/wp-content/uploads/2024/01/swiftui_roadmap_preview.webp 640w, https://www.swiftyplace.com/wp-content/uploads/2024/01/swiftui_roadmap_preview-300x234.webp 300w" sizes="(max-width: 640px) 100vw, 640px" /></a></figure>

</div>

<div class="gb-container gb-container-98352fe6">

<h2 class="gb-headline gb-headline-4aacd94c gb-headline-text">Feeling Lost in SwiftUI?</h2>



<p class="gb-headline gb-headline-5e6c4f85 gb-headline-text">This SwiftUI roadmap shows you what to learn next.</p>



<ul style="margin-top:0;margin-bottom:0;font-size:18px" class="wp-block-list">
<li>Key concepts at a glance</li>



<li>Spot your knowledge gaps</li>



<li>Guide your learning path</li>
</ul>


<div class="gb-container gb-container-34a8ad02">

<a class="gb-button gb-button-63e90e76 gb-button-blue" href="https://school.swiftyplace.com/f/swiftui-roadmap" target="_blank" rel="noopener noreferrer"><span class="gb-button-text">Get the FREE PDF</span><span class="gb-icon"><svg aria-hidden="true" role="img" height="1em" width="1em" viewBox="0 0 256 512" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"></path></svg></span></a>

</div>


<p class="gb-headline gb-headline-7ef80e86 gb-headline-text">Ideal for beginners and self-learners.</p>

</div>
</div>
</div>


<div style="height:58px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Testing Translations in Xcode Preview to Localize iOS apps</h3>



<p>Xcode preview uses the default language English. You can change this by overriding the environment value for locale. In the following I added a second preview for German:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono-NL.ttf" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="#Preview(&quot;English&quot;) {
    ContentView()
}
#Preview(&quot;Deutsch&quot;) {
    ContentView()
        .environment(\.locale, Locale(identifier: &quot;DE&quot;))
}" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F6F6F4">#</span><span style="color: #97E1F1">Preview</span><span style="color: #F6F6F4">(</span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">English</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">) {</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #97E1F1">ContentView</span><span style="color: #F6F6F4">()</span></span>
<span class="line"><span style="color: #F6F6F4">}</span></span>
<span class="line"><span style="color: #F6F6F4">#</span><span style="color: #97E1F1">Preview</span><span style="color: #F6F6F4">(</span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">Deutsch</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">) {</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #97E1F1">ContentView</span><span style="color: #F6F6F4">()</span></span>
<span class="line"><span style="color: #F6F6F4">        .</span><span style="color: #97E1F1">environment</span><span style="color: #F6F6F4">(\.locale, </span><span style="color: #97E1F1">Locale</span><span style="color: #F6F6F4">(</span><span style="color: #97E1F1">identifier</span><span style="color: #F6F6F4">: </span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">DE</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">))</span></span>
<span class="line"><span style="color: #F6F6F4">}</span></span></code></pre></div>



<div style="height:23px" aria-hidden="true" class="wp-block-spacer"></div>



<p>You can use Xcode previews to test different translations for e.g. iOS. This is important to see if the text fits on screen and looks good.</p>



<figure class="wp-block-image"><img decoding="async" src="https://www.swiftyplace.com/wp-content/uploads/2023/09/xcode-preview-locale.webp" alt="Xcode preview with different locale. localize iOS apps"/></figure>



<div style="height:51px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Plurals localization using String Catalogs in iOS</h2>



<p>Plurals localization using string catalogs in iOS is a powerful tool that makes managing multiple variations of strings so much easier. With string catalogs, you can easily handle cases where you need to display different forms of a word based on the quantity, like “book” or “books.” By using the localized string resource and specifying the plural form, you can effortlessly handle singular and plural variations in different languages. This feature saves you from the hassle of manually tracking and translating each variation, and it gives you peace of mind knowing that your app is fully localized. So, don’t hesitate to use string catalogs for plurals localization in iOS. It’s a game-changer that will make your localization process much smoother.</p>



<p>In the following, I want to show a text that includes a book count. I want to show the following texts:</p>



<ul class="wp-block-list">
<li>Singular Case: &#8220;You have one book in store&#8221;</li>



<li>Plural Case: &#8220;You have 10 books in store&#8221;</li>
</ul>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono-NL.ttf" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="import SwiftUI
struct ContentView: View {

    let bookCount: Int = 10

    var body: some View {
        VStack {
            Text(&quot;You have \(bookCount) books in store&quot;)
        }
    }
}" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F286C4">import</span><span style="color: #F6F6F4"> </span><span style="color: #97E1F1; font-style: italic">SwiftUI</span></span>
<span class="line"><span style="color: #F286C4">struct</span><span style="color: #F6F6F4"> </span><span style="color: #97E1F1; font-style: italic">ContentView</span><span style="color: #F6F6F4">: View {</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #F286C4">let</span><span style="color: #F6F6F4"> bookCount: </span><span style="color: #97E1F1; font-style: italic">Int</span><span style="color: #F6F6F4"> </span><span style="color: #F286C4">=</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">10</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #F286C4">var</span><span style="color: #F6F6F4"> body: </span><span style="color: #F286C4">some</span><span style="color: #F6F6F4"> View {</span></span>
<span class="line"><span style="color: #F6F6F4">        VStack {</span></span>
<span class="line"><span style="color: #F6F6F4">            </span><span style="color: #97E1F1">Text</span><span style="color: #F6F6F4">(</span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">You have </span><span style="color: #F286C4">\(</span><span style="color: #E7EE98">bookCount</span><span style="color: #F286C4">)</span><span style="color: #E7EE98"> books in store</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">)</span></span>
<span class="line"><span style="color: #F6F6F4">        }</span></span>
<span class="line"><span style="color: #F6F6F4">    }</span></span>
<span class="line"><span style="color: #F6F6F4">}</span></span></code></pre></div>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Build the project and go to your string catalog file. Go into your default language which is for me English. Select the string with the multiple and choose &#8220;Vary by plural&#8221;.</p>



<figure class="wp-block-image"><img decoding="async" src="https://www.swiftyplace.com/wp-content/uploads/2023/09/multiple-string-english-add-vary-1024x307.webp" alt=""/></figure>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p>You can now enter a string for the single and plural case separately.</p>



<figure class="wp-block-image"><img decoding="async" src="https://www.swiftyplace.com/wp-content/uploads/2023/09/muliple-string-english.webp" alt="dealing with multiple number in string variations English"/></figure>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Similarly, you can also deal with texts that have multiple plural variations e.g:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono-NL.ttf" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="import SwiftUI
struct ContentView: View {

    let bookCount: Int = 10
    let storeCount: Int = 2

    var body: some View {
            Text(&quot;You have \(bookCount) books in \(storeCount) stores&quot;)
    }
}" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F286C4">import</span><span style="color: #F6F6F4"> </span><span style="color: #97E1F1; font-style: italic">SwiftUI</span></span>
<span class="line"><span style="color: #F286C4">struct</span><span style="color: #F6F6F4"> </span><span style="color: #97E1F1; font-style: italic">ContentView</span><span style="color: #F6F6F4">: View {</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #F286C4">let</span><span style="color: #F6F6F4"> bookCount: </span><span style="color: #97E1F1; font-style: italic">Int</span><span style="color: #F6F6F4"> </span><span style="color: #F286C4">=</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">10</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #F286C4">let</span><span style="color: #F6F6F4"> storeCount: </span><span style="color: #97E1F1; font-style: italic">Int</span><span style="color: #F6F6F4"> </span><span style="color: #F286C4">=</span><span style="color: #F6F6F4"> </span><span style="color: #BF9EEE">2</span></span>
<span class="line"></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #F286C4">var</span><span style="color: #F6F6F4"> body: </span><span style="color: #F286C4">some</span><span style="color: #F6F6F4"> View {</span></span>
<span class="line"><span style="color: #F6F6F4">            </span><span style="color: #97E1F1">Text</span><span style="color: #F6F6F4">(</span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">You have </span><span style="color: #F286C4">\(</span><span style="color: #E7EE98">bookCount</span><span style="color: #F286C4">)</span><span style="color: #E7EE98"> books in </span><span style="color: #F286C4">\(</span><span style="color: #E7EE98">storeCount</span><span style="color: #F286C4">)</span><span style="color: #E7EE98"> stores</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">)</span></span>
<span class="line"><span style="color: #F6F6F4">    }</span></span>
<span class="line"><span style="color: #F6F6F4">}</span></span></code></pre></div>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Build the project and go to your string catalog file. Go into your default language which is for me English. Select the string with the multiple and choose &#8220;Vary by plural&#8221;. From the menu you can now add both arguments for &#8220;books&#8221; and &#8220;stores&#8221;. Enter the string values for both variations separately.</p>



<figure class="wp-block-image"><img decoding="async" src="https://www.swiftyplace.com/wp-content/uploads/2023/09/muliple-multiple-string-english-1024x343.webp" alt=""/></figure>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image"><img decoding="async" src="https://www.swiftyplace.com/wp-content/uploads/2023/09/muliple-multiple-string-german.webp" alt="dealing with complex multiple number in string variations German"/></figure>



<div style="height:54px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">How do you localize image assets in iOS?</h2>



<p>You can add images to the asset catalog and add localisation. In the below example, I use 3 different images for English, German and French:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono-NL.ttf" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="import SwiftUI
struct ImageLocalizationView: View {
    var body: some View {
        VStack {
            Text(&quot;Hello, world!&quot;)
                .font(.title)
            Image(&quot;test_image&quot;)
                .resizable()
                .scaledToFit()
        }
    }
}
#Preview(&quot;en&quot;) {
    ImageLocalizationView()
}
#Preview(&quot;de&quot;) {
    ImageLocalizationView()
        .environment(\.locale, .init(identifier: &quot;de&quot;))
}
#Preview(&quot;fr&quot;) {
    ImageLocalizationView()
        .environment(\.locale, .init(identifier: &quot;fr&quot;))
}" style="color:#f6f6f4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula-soft" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #F286C4">import</span><span style="color: #F6F6F4"> </span><span style="color: #97E1F1; font-style: italic">SwiftUI</span></span>
<span class="line"><span style="color: #F286C4">struct</span><span style="color: #F6F6F4"> </span><span style="color: #97E1F1; font-style: italic">ImageLocalizationView</span><span style="color: #F6F6F4">: View {</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #F286C4">var</span><span style="color: #F6F6F4"> body: </span><span style="color: #F286C4">some</span><span style="color: #F6F6F4"> View {</span></span>
<span class="line"><span style="color: #F6F6F4">        VStack {</span></span>
<span class="line"><span style="color: #F6F6F4">            </span><span style="color: #97E1F1">Text</span><span style="color: #F6F6F4">(</span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">Hello, world!</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">)</span></span>
<span class="line"><span style="color: #F6F6F4">                .</span><span style="color: #97E1F1">font</span><span style="color: #F6F6F4">(.title)</span></span>
<span class="line"><span style="color: #F6F6F4">            </span><span style="color: #97E1F1">Image</span><span style="color: #F6F6F4">(</span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">test_image</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">)</span></span>
<span class="line"><span style="color: #F6F6F4">                .</span><span style="color: #97E1F1">resizable</span><span style="color: #F6F6F4">()</span></span>
<span class="line"><span style="color: #F6F6F4">                .</span><span style="color: #97E1F1">scaledToFit</span><span style="color: #F6F6F4">()</span></span>
<span class="line"><span style="color: #F6F6F4">        }</span></span>
<span class="line"><span style="color: #F6F6F4">    }</span></span>
<span class="line"><span style="color: #F6F6F4">}</span></span>
<span class="line"><span style="color: #F6F6F4">#</span><span style="color: #97E1F1">Preview</span><span style="color: #F6F6F4">(</span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">en</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">) {</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #97E1F1">ImageLocalizationView</span><span style="color: #F6F6F4">()</span></span>
<span class="line"><span style="color: #F6F6F4">}</span></span>
<span class="line"><span style="color: #F6F6F4">#</span><span style="color: #97E1F1">Preview</span><span style="color: #F6F6F4">(</span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">de</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">) {</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #97E1F1">ImageLocalizationView</span><span style="color: #F6F6F4">()</span></span>
<span class="line"><span style="color: #F6F6F4">        .</span><span style="color: #97E1F1">environment</span><span style="color: #F6F6F4">(\.locale, .</span><span style="color: #F286C4">init</span><span style="color: #F6F6F4">(</span><span style="color: #97E1F1">identifier</span><span style="color: #F6F6F4">: </span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">de</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">))</span></span>
<span class="line"><span style="color: #F6F6F4">}</span></span>
<span class="line"><span style="color: #F6F6F4">#</span><span style="color: #97E1F1">Preview</span><span style="color: #F6F6F4">(</span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">fr</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">) {</span></span>
<span class="line"><span style="color: #F6F6F4">    </span><span style="color: #97E1F1">ImageLocalizationView</span><span style="color: #F6F6F4">()</span></span>
<span class="line"><span style="color: #F6F6F4">        .</span><span style="color: #97E1F1">environment</span><span style="color: #F6F6F4">(\.locale, .</span><span style="color: #F286C4">init</span><span style="color: #F6F6F4">(</span><span style="color: #97E1F1">identifier</span><span style="color: #F6F6F4">: </span><span style="color: #DEE492">&quot;</span><span style="color: #E7EE98">fr</span><span style="color: #DEE492">&quot;</span><span style="color: #F6F6F4">))</span></span>
<span class="line"><span style="color: #F6F6F4">}</span></span></code></pre></div>



<div style="height:21px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image"><img decoding="async" src="https://www.swiftyplace.com/wp-content/uploads/2023/09/swiftui-image-localization.webp" alt=""/></figure>



<div style="height:35px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Conclusion</h2>



<p>In conclusion, using string catalogs in Xcode 15 makes localizing and managing string resources in iOS apps so much easier. With string catalogs, you can easily track and translate all the strings in your project, saving you time and hassle. It automatically collects the strings and allows you to add translations for different languages. Plus, it handles more advanced cases like plurals. So, if you’re looking to translate and localize your iOS app, string catalogs in Xcode 15 are definitely worth using.</p>



<p>Good luck with your app localization journey!</p>



<p>Further Reading:</p>



<ul class="wp-block-list">
<li><a href="https://www.swiftyplace.com/blog/swift-date-formatting-10-steps-guide">Swift Date Formatting: 10 Steps Guide</a></li>



<li><a style="font-size: revert;" href="https://www.swiftyplace.com/blog/swiftui-font-and-texts">SwiftUI Font and Texts</a> <h1 style="font-family: var( --e-global-typography-primary-font-family ), Sans-serif; color: #ffffff; text-align: center;"></h1> </li>
</ul>
<p>The post <a rel="nofollow" href="https://www.swiftyplace.com/blog/localization-ios-app-xcode-15">How to translate and localize iOS app with string catalogs in Xcode 15</a> appeared first on <a rel="nofollow" href="https://www.swiftyplace.com">swiftyplace</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.swiftyplace.com/blog/localization-ios-app-xcode-15/feed</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 

Served from: www.swiftyplace.com @ 2026-04-19 12:36:55 by W3 Total Cache
-->