I have several .storyboard and .xib files. The xcode localisation feature created a separate .string file for each one.
How do I combine all language .string files into one file (that i can use in the entire application), so that I get a better overview of my texts.
Unfortunately, there is no easy way.
The only way that I can think of is remove all the texts from all the UI Elements from all .storyboard and .xib and then set all the texts in code.
Then only you can only use one .string file for each language.
Related
I am a little confused about the implementation of localization in Xcode. I know that I can provide as many languages as I want by creating the appropriate XY.Iproj folders and inserting the .strings and Localizable.strings files into them. This all happens automatically with Xcode.
Unfortunately I have problems understanding the Base concept. As I understood it so far, the development language is to be used there. In my case this is English, so should I write in the storyboard and XIB files as text directly in English? For example the headline (a label) of the settings page with the content "Settings"?
But why do I have also the .strings file with the translation into English? That would be redundant, because I have already entered English text directly in the Base file and the .strings file contains the same text again.
Or should the storyboard and XIB files only have identifiers like "settings_page_headline" as content for labels? But that's nonsense, because these labels are good for nothing...
Or can I completely delete the .strings for the English translation if I have already inserted the English content in the storyboard and XIB files?
I hope you can enlighten me a bit. Of course I have read the documentation of Apple, there my problem of understanding is not discussed as much as I need to understand it.
Main.storyboard (Base) and Main.strings (English) contain the same content:
Content of the Main.storyboard (Base):
Content of the Main.strings (English):
"tos-eB-aJc.title" = "Send Feedback";
"S56-oM-eis.title" = "Rate this App";
From Apple documentation:
Xcode creates a Base.lproj folder in your project folder and adds to it the resource files you select. Xcode creates a language folder for the development language but only adds resources that need translation to the folder. For example, if you select English as the development language, Xcode inserts the resource file in the Base.lproj project folder but not the en.lproj folder because the resource is already in English.
link: InternationalizingYourUserInterface
As I understand it, this was done to optimize the import of localization files. Also you can not localize some .xib . If you want to understand how, by what logic and in what order the localization files are loading, read this document from Apple: LocalizingYourApp
I'm coding an iPhone/iPad App in Obj-C. From the beginning, I've coded all my layouts (I use Auto Layout) programmatically.
So, now I'm coming to where I want to Internationalize my App and I keep seeing that I need to turn on Base Internationalization.
But, when I read about Base Internationalization does, I read that Base Internationalization separates user-facing code from .storyboard and .xib files.
I have no .storyboard or .xib files. All my user-facing strings make use of NSLocalizedString.
My tentative conclusion is that I don't need to enable Base Internationalization but I want to put this out here as a question in case I'm missing something.
You do not need base internationalization if all your strings are already in your code.
You have basically already done the work that base internationalization would have done for you. It would have extracted text from the .xib and .storyboard files and created .strings files to then add the text back via NSLocalizedString.
You can avoid the Xcode warning by checking base internationalization, as there will be no resources to extract strings from. It simply creates a new language folder named Base.lproj from which any language is then derived.
I'm trying to create a localization file for strings. I added a file named Localizable.strings in project. But localization window does not appear in other languages.I can only choose some languages. What do I need to be able to select other languages. (Ex: Turkish,Polish...)
You can add a lot of languages in project properties. Look at the picture. Hope this help.
I need to maintain a project that produces two applications.
I've created two targets that share all the view Controller and Models. The only difference in these targets are storyboards and a couple of configuration files.
For Localizable.strings file I don't see any problem, as I said View Controllers and Models are shared and I've used NSLocalizedString function in these files. My doubts are related to the .storyboard files translation. Since the storyboards are really similar (they differ for the most for colors, position of some elements and for a couple of label text) I feel that is useless to maintain different strings file that contains almost the same data.
Any suggestion? Is there a way to use the same translation file for different storyboards?
If your strings are identical, I would move to Base Internationalization and keep the text in .strings files rather than in localized .storyboard files.
I have an IOS project that has a es.lproj folder with a string file inside it. Now within the project I have a sub project (feedback system) that has its own es.lproj folder with a string file inside.
The problem is that the app when testing is choosing to translate the text based upon only one of the string files and is ignoring the other.
I want to keep the localisation for the feedback system separate so is it possible to have two of the same language files within the project?
All you need to do is use NSLocalizedStringFromTable instead of NSLocalizedString.
In your subproject, specify a table name for all of your strings.
I have a larger project with about 20 strings files using this approach.
You will probably need to use the genstrings command-line tool to generate the strings files from your code.