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:
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.
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:
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
Basically I can't add Localizations from the project > info > Localizations section.
When i try to do so, i can see the languages and select the one I want. But when the "Choose files and reference language..." screen appears it is completely empty. When i press finish nothing happens as well.
My goal is to localize the app name, so i have to add the InfoPlist.strings files to the languages I need.
If i try just selecting the file and pressing the localize button i get a prompt asking me to select the language, if i try any of the languages shown there i get this message error:
“Info.plist” couldn’t be moved to “ja.lproj” because either the former
doesn't exist, or the folder containing the latter doesn't exist.
I even tried manually adding the .lproj folders and adding the files there but the app name doesn't change. I suspect that it is because the project is configured to look for those in a different place.
This project was originally created with cocos2dx so it came with many things preconfigured, that was a long time ago with an old version of cocos2dx, so i suppose the folder structure has something to do. Still i don't know where to fix to at least be able to add more localizations.
The solution I found was to first create the "InfoPlist.strings" manually as a file inside the project directory. Then add the file from xcode. Then clicked on localization and select at least 1 language. Then i could add/remove localizations from my project settings.
I have searched related questions and tried many suggested methods but none seems to work.
I have a japanese-only App that when run on an english device gets UI items such as back buttons translated ("Back").
To achieve this I have:
Deleted the English from "Localizations" from my project and chose to delete localized files (was a single *.strings file).
Changed CFBundleDevelopmentRegion in my Info.plist from jp_JPto jp as I read it should match the name of the *.lproj folder.
Cleaned, deleted, closed Xcode, etc. But default UI items are still getting translated to english.
Also I get some weird behavior in Xcode 5 now:
Checking the "Use Base Internationalization" checkbook presents an empty "Choose files and reference language to create Base localization". Choosing either Cancel or Finish has no effect and nothing happens.
Clicking on the "+" button to add the Other > "Base (Base)" localization does nothing.
I thing that my problem seems to be that my Base localization is still somehow english but I can't find a way to change that. Any ideas?
I found that to truly remove English support I have to properly set the CFBundleDevelopmentRegion into a full valid region (e.g. ja_JP) and not just a language (just ja still resulted in English showing up).
When you have a valid region Xcode will show you the name of your country instead of the raw value in the Plist editor.
Seems like some modules, such as MFMailComposeViewController, get localized to English no matter what (tested on iOS 6 and 7).
I encountered the same issue. Here are the steps I did to get past them.
Localize your storyboard file.
Select your Storyboard file in Xcode.
In the “File Inspector”, under the “Localization” sub header, press the “Localize…” button.
A dialog appears that says “Do you want to localize this file? The file will be moved into the lproj folder for the following language.” It lists a language. For me it was “English” and I chose that. For you, I suspect it will be “Japanese”.
Press the “Localize” button.
If it warns you that your storyboard file has changed outside of the project, choose “Save anyway”. If you don't it deletes the storyboard from your project. This happened to me with a source controlled project, but not with a new empty project.
Go back to your project and check the “Use Base Internationalization” checkbox. Your storyboard should show up in the "Choose files and reference language to create Base localization" sheet.
If you go back to your storyboard, you will see “Base” as the checked localization. I had my language (English) show up as an option. When I checked it, a storyboard.strings file was created. Since my base was already in my preferred language, I didn’t need a strings file so I removed it. I presume that if I had another language, I could select that and get a storyboard.strings file for that language.
I'm starting to get confused..I've wanted to finally add my translation file for all strings to my app according to ray wenderlich's tutorial. But somehow now everything got messed up. I removed now every localization again, which deleted my strings file, the storyboard etc. And now I have no localization language set in the project settings and I've copied all files back from the trash.
But my localized string (NSLocalizedString(..)) somehow don't load..or load something else. I've changed some of them to check if my strings file in the project explorer is actually used but it still uses the old strings and I have no idea from where..I've checked the project folder and there aren't any other files.
How can I set up everything again that it works? How can I set the strings file it should use? And how should I set up then the localization, with or without base language?
Edit: And in the simulator I cannot get my app running..it's showing only a black screen. Whereas on my iphone it still works (if I use my iphone from Xcode).
I guess I've deleted all my languages in project settings and now I cannot add any localization anymore :-(
Here's what I would try:
Check your project folder for any leftover .lproj folders / .strings file and delete
Clean / Build
Start localization from scratch following SmoothLocalize's Tutorial
This should delete all old files and create a new default localizable.strings, and then you can add more languages.
A while ago i decided to make my application multilanguage. I ended up using localizable.strings. So a different file for each language with all the translations in it.
In my main storyboard i just use NSLocalizedString(#"example", nil); on all my elements etc.
The problem i have is that i just found out that i somehow ended up with a storyboard for each language. I can fold out my MainStoryboard_iPhone.storyboard and under this it lists the language specific storyboards (MainStoryboard_iPhone.storyboard (English) and MainStoryboard_iPhone.storyboard (Dutch). Since i do not use this because i do everything with the localizable.strings i do not need this language specific storyboards. Over time they also became inconsistent. The english board has all the current changes and the dutch one does not.
My question is:
How can i safely remove these language specific storyboards and just keep using the localizable.strings. I want to end up with only 1 main storyboard (the top level one in the image above). I do not want to ruin my project and i want to be sure that the solution i use is correct.
Thank you!
I had the same issue.
I solved it by selecting "Base internationalization" in the project settings. Next, click the file inspector icon (right pane) for your storyboard file and make sure only Base is checked. Do not check the other languages.
This will fix the issue.
Don't bother with Base internationalization for your localizable.strings file, you can still use your regular translation setup there (ie, English and Dutch).
To "roll back" a localized File. you have to navigate to the folder where your class should be. You see the folder "en.lporj" (and the other languages) and there is the file you need.
-
Now copy to a save place, remove the multi-language file and in xcode and tell to remove from disk. Copy it again into your folder where you need it and import it in xcode.
Now the settings for the translation are resettet. you should recheck if no links went lost (simple clean build should be enought for this).
I handle only .xib file at the moment, but the procedure should be the same for all files :)
(if not, please let me know :D)
Greets,
geo
I have an app that is localized for two languages: English and Danish. If I set the device to any other language (say, French) the app crashes. It seems as if it's not really loading the XIB files, or getting a generic version of them that is not properly initialized.
I guess that I naively assumed that the app would load the English version if it was set for a language other than English or Danish.
What do I do? Is there a way to ensure that behavior?
Cause:
Somehow XCode had created two sets of en.lproj and da.lproj directories. One set was in the project root (oh, an en.lproj was here called English.lproj) and the other was in Classes. The "missing" XIB files were in the directory in Classes.
Solution:
Copy XIB files to the proper folders in the root. Remove original ones from project (go ahead and say move to thrash, you just copied them...). Add copies in proper location to project - all in one drag operation - and do not copy to project (they are already in the proper location).
The app should load the english version if you set the device language to, for example, french.
You should give some details how you are loading the XIB.
It's rather impossible to give an answer to this question without knowledge about your specific implementation.