{"id":3137,"date":"2023-06-08T09:39:36","date_gmt":"2023-06-08T13:39:36","guid":{"rendered":"https:\/\/michaelrowe01.com\/?p=3137"},"modified":"2023-06-08T09:39:39","modified_gmt":"2023-06-08T13:39:39","slug":"discover-string-catalogs","status":"publish","type":"post","link":"https:\/\/michaelrowe01.com\/index.php\/blog\/discover-string-catalogs\/","title":{"rendered":"Discover String Catalogs"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"371\" data-attachment-id=\"3138\" data-permalink=\"https:\/\/michaelrowe01.com\/index.php\/blog\/discover-string-catalogs\/attachment\/%ef%a3%bfwwdc23-14\/\" data-orig-file=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-14.png?fit=1920%2C1080&amp;ssl=1\" data-orig-size=\"1920,1080\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"\uf8ffWWDC23-14\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-14.png?fit=660%2C371&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-14.png?resize=660%2C371&#038;ssl=1\" alt=\"\" class=\"wp-image-3138\" srcset=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-14.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-14.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-14.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-14.png?resize=1536%2C864&amp;ssl=1 1536w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-14.png?w=1920&amp;ssl=1 1920w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-14.png?w=1320&amp;ssl=1 1320w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Localization is created with String Catalogs, OS supports 40 languages today<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You used to have to maintain Strings and StringDict in your project.&nbsp; In Xcode 15 you will have String catalogs to simplify the process<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Will update my own app to this quickly.&nbsp; Complex editing is enabled to make it easier to convert strings, including ability to change strings by device.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Extract<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Localizable strings are simply text presented to user at runtime.<\/li>\n\n\n\n<li>Key (required) &#8211; usually the sting itself<\/li>\n\n\n\n<li>Default value &#8211; usually defaults back to Key<\/li>\n\n\n\n<li>String Comments &#8211; to provide translator context about where and how it is used<\/li>\n\n\n\n<li>Table corresponding to one ore more files where translations are stored. bY default this is Localizable table.<\/li>\n\n\n\n<li>String Catalog contains the entire string table in a single file.&nbsp; You can create multiple String Catalogs<\/li>\n\n\n\n<li>Xcode will create the catalog and try to keep it in sync.<\/li>\n\n\n\n<li>You should define you localizable strings as such with LocalizedStringResource<\/li>\n\n\n\n<li>Change build setting &#8211; <strong>Use Compiler to Extract Swift String<\/strong> to make sure that Xcode will extract for your, you can also define your own localized custom macros<\/li>\n\n\n\n<li>In Interface Builder strings are automatically defined as localizable.<\/li>\n\n\n\n<li>Add a info.plist to the catalog to capture values in plist files&nbsp;<\/li>\n\n\n\n<li>Every time you build Xcode will export to the catalog &#8211; code is source of truth and the catalog will reflect state of the localized value. It will be considered stale if removed from code an you have a translation defined.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Edit<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The editor allows for first class support of state and progress of translation.\n<ul class=\"wp-block-list\">\n<li>New &#8211; untranslated<\/li>\n\n\n\n<li>Stale &#8211; No longer seen in the code<\/li>\n\n\n\n<li>Needs Review &#8211; may require change&nbsp;<\/li>\n\n\n\n<li>Translated &#8211; Green check mark &#8211; no action needed<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Pluralization is a challenge\n<ul class=\"wp-block-list\">\n<li>You need to change the grammar in English&nbsp;<\/li>\n\n\n\n<li>But in other languages it may be more complex<\/li>\n\n\n\n<li>You used to need a StringDict file.&nbsp; New feature has built in value variations via context menu<\/li>\n\n\n\n<li>Complex examples like you have X items in X packages &#8211; which may change if you have 6 items in 1 package&nbsp;<\/li>\n\n\n\n<li>You define substitutions for items and packages in the prior statement<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>You can define manual strings that are defined in code or a database<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Export<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>To work with translators &#8211; you can export localization catalog for each language so you can send to translation team.\n<ul class=\"wp-block-list\">\n<li>The xliff file is standard format for storing translations.&nbsp;<\/li>\n\n\n\n<li>There are some changes based on catalog instead of stringDict format, this may require automation tools to change<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Change make sure export works correctly set \u201c<strong>Localization Prefers String Catalogs<\/strong>\u201d in build settings to \u201c<strong>Yes<\/strong>\u201d<\/li>\n\n\n\n<li>Import will just add it back in correctly<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Build<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>During Build catalogs are json files under the hood and easily diffable in source code<\/li>\n\n\n\n<li>You can back deploy to any OS target<\/li>\n\n\n\n<li>Source strings are not stored in final build<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Migrate&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>To migrate your existing project, pick files and targets to migrate<\/li>\n\n\n\n<li>Right click and choose Migrate to String Catalog<\/li>\n\n\n\n<li>You must use swift tools version 5.9 or higher<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Localization is created with String Catalogs, OS supports 40 languages today You used to have to maintain Strings and StringDict in your project.&nbsp; In Xcode 15 you will have String catalogs to simplify the process Will update my own app to this quickly.&nbsp; Complex editing is enabled to make it easier to convert strings, including [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_wp_convertkit_post_meta":{"form":"-1","landing_page":"0","tag":"0","restrict_content":"0"},"hide_page_title":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[2,3],"tags":[581,707,680],"class_list":["post-3137","post","type-post","status-publish","format-standard","hentry","category-blog","category-personal-softwareandit","tag-localization","tag-string-catalogs","tag-wwdc23"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2aMa8-OB","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts\/3137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/comments?post=3137"}],"version-history":[{"count":1,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts\/3137\/revisions"}],"predecessor-version":[{"id":3139,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts\/3137\/revisions\/3139"}],"wp:attachment":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/media?parent=3137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/categories?post=3137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/tags?post=3137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}