MonoTouch localized xibs/nibs not placed in bundle correctly - localization

I am trying to localize the xib files in my MonoTouch app. I have them included in the project and the build action is set to page. When I run it random things are in a different language.
Looking at the resulting app bundle all of the nib files are at the root. I'm guessing that whichever xib gets processed last is the one that wins. Looking at a localized app built by Xcode the nib files are separated out into en-US.lproj, fr-CA.lproj, etc...
I've searched around for help on this and surprisingly can't seem to find anything.

Create the lproj folders in your project, and place the localized xibs in those.

Related

ios - main.storyboard strings not found in base localization

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.

Cannot localize my app (adding a localization language shows no files and adds nothing)

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.

iOS: Localization gone wrong

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.

xCode Localization - where to put .lproj files?

I've looked for similar questions, but this must have been asked before. Either way, please point me in the right direction.
I've localized an app for the first time. It seems to work ok, but I have two sets of .lproj files. One set is in the settings bundle, and the other is in the main project directory.
It also appears that some settings are affected by one .lproj file content and other settings are affected by the other.
Should I leave "well enough" alone? Should I combine somehow? If so, where is the correct place?
If I find this has already been answered, please forgive. I will either delete this question, or point it to the existing response.
Thanks
That is really OK to have lproj's all over the project. What is more important - to keep translated files inside of Xcode file tree. You can easily localize your nibs and any other files just by selecting file you need to localize and by adding File localization in File Inspector.

My app crashes in other languages. Xibs seem to not be loaded. Why?

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.

Resources