ios - main.storyboard strings not found in base localization

Viewed 772

In xcode 8.3.3, playing with my first serious localization. I have added two languages, "use base localization" is on, exported the xliff, imported the translations, and all seems basically as I would expect it to. I have a base.lproj folder with main.storyboard, my base Localizable.strings, and InfoPlist.strings. I have the two language lproj folders, each with their files in them. In the app, they appear organized by type:

screenshot of Main.storyboard in project structure

enter image description here

If I set the app to run in either of those languages, it works fine (I also had to add a copy to the build phases to copy Localizable.strings and InfoPlist.strings). No errors or warnings in the console, app works and shows the correct text for storyboard strings and code.

However, when I am in the base language (English, if it matters), when the app starts, it throws out warnings for all of the storyboard strings. Something along the lines of:

2017-07-16 10:57:22.977774-0500 AppName [1574:688423] [strings] ERROR: bFh-6v-hYF.text not found in table Main of bundle CFBundle 0x101d00020 </var/containers/Bundle/Application/guidguid-guid-guid-guid-guidguidguid/AppName.app> (executable, loaded)

N.B. all of the storyboard strings are, in fact, displayed correctly in the base language, it just also throws these errors in to the log. Before I realized I needed to have base Localizable.strings, when it couldn't find those it would display the "Key", which for this project is the translatable string, but they would be displayed in upper case. That is not the case here. The app looks fine, but throws errors.

So my first attempt (after the ritual clean and rebuild), was to create a Main.strings file and try to import it as the base version of said strings, since it apparently wasn't finding them in the Main.storyboard that was already in base.lproj. No luck there, it would not let me do that - which makes sense, since it already thinks Main.storyboard is the base. Next thought was to try to copy the Main.storyboard to the bundle as part of the build phase, but that didn't help. After a day of reading articles about all the issues others have had with i18n on this platform, I haven't found quite this same problem, and am out of ideas.

I can't say that it seems like a big deal to kill these last errors, but they bother me, since otherwise it runs clean, and it runs clean in any language other than the base.

1 Answers

Your problem is by now surely solved, but maybe somebody else (like me) gets a similar error message:
I my case, the main storyboard was for some reason no longer localized.

I thus localized it, which created two subfiles:
enter image description here
So, for a storyboard to be localized, required are:

  • always a file Main.storyboard, in the folder Base.lproj
  • for every localization a file Main.strings, in the folder XX.lproj, where XX is specific for the language, e.g. de for German.

As soon as I did the localization of the storyboard, the error message disappeared.

Related