iOS localization. Aim to localize strings in all languages, but images in only some languages - iphone

I'd like to localize my application with the following pattern:
Localize all strings (say English, French and German (don't mention the war!))
Localize some images in some languages (say just English and French)
I can localize the strings without issue. My problem is that when I add the German strings, the other resources that are localized into English and French attempt to find a German version. I don't want to provide a German version (trying to avoid too many superfluous images as they bulk up the size of the app).
Can anyone suggest a way of telling the application not to bother looking for a German version of the images.
My problem isn't adding languages, it's ignoring them under certain conditions. I don't want to include a German version of "a.png", but I do want to include a French version of "a.png". When the user's language is set to German, I'd like it to select the default language which is English.

Having had the same issue I want to follow up on this as the suggested resolution did not work exactly as quoted.
My setup is 3 localized languages, de, en, fr. The .lproj folders Xcode created are thus named
en.lproj
de.lproj
fr.lproj
I have a graphical button with "start" on it that needs localization from english to french but not to german (as it is the same word).
My "Localization native development region" was set to "English", which must have been the default (maybe a while back, the project has been a wip for quite a while).
The button did not show up on german devices. Switching to "EN" or any of the suggestions from Xcode ("United Kingdom", "United States of America") did not resolve the issue.
The solution was simpel. The string in the "Localization native development region" needs to exactly match the (native language).lproj string. So setting it to "en" it finally resolved the issue.
Hope this helps whoever stumbles upon this question.

iOS (and Mac OS) should always fall back to the app's default language. If you don't include the image.png in the de.lproj resources folder, the app should use the en.lproj/image.png file in its place.
Look for key: "Localization native development region" in the Target > Info pane of Xcode. Make sure that says EN.

I don't have that much experience but as far as I'm concerned, your program should just look for the german image, find nothing and then try to load the english image instead.

Related

iPhone wrong Localizable.strings used

I have a project with different Localizable.string files:
../en-GB.lproj
/Localizable.strings
../en-US.lproj
/Localizable.strings
../fr-FR.lproj
/Localizable.strings
../fr-CH.lproj
/Localizable.strings
etc... with about 10 different languages. All are UTF16 encoded. I use XCode4. When I configure my test iPod in fr-FR and launch my app the line:
NSLog(#"Current Locale: %#", [[NSLocale currentLocale] localeIdentifier]);
returns: Current Locale: fr_FR
But all my NSLocalizedString(#"my_string",nil) always return the values located in my Portugese localizable. Any clue for that problem?
Not sure if this applies to you, but i have noticed similar problems using ShareKit. It wasn't ShareKit's problem per se, but the problem involved localizable.strings files inside the library that overlapped mine (for example, I had 2 localizable.strings for the english language. One was mine, the other one was for sharekit).
The app was running, and was finding it difficult to decide which of the two localizable.strings file should it choose to draw strings from.
The solution was transferring all strings in one file end deleting the duplicate files, of course.
I hope I helped.
Firstly check your Scheme Options. You might have changed the "Application Region" which in above case maybe set to "Portugal". This should be set to "System Region" and "Application Language" to "System Language"
Make sure that you're dragging the localized files to their right folder. It's pretty easy to put in the wrong place.
Have a look here for the complete list of what you should do, including screenshots of where you should drag the translations in the project tree:
http://www.icanlocalize.com/site/tutorials/iphone-applications-localization-guide/
Try doing a clean and remove the app off the device/simulator and rebuild/deploy.
I have run into issues when adding new localisations and the device caching the app resources.
Also when I localise I tend to use the country code as the name for the .lproj folder eg.:
en.lproj
fr.lproj

about iOS localization

In the following doc:
http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPInternational/Articles/LanguageDesignations.html
it's mentioned that
In iOS, the bundle interfaces do not take dialect or script information
into account when looking for
localized resources; only the language
designator code is considered.
Therefore if your project includes
language-specific project directories
with both a language and region
designator, those directories are
ignored. The bundle interfaces in Mac
OS X do support region designators in
language-specific project
directories.
I don't quite understand this. Does it mean that the name of .lproj directory cannot contain any region code?
But at least I know that iOS accepts zh_TW.lproj, zh_CN.lproj. How about en_GB.lproj and en-GB_GB.lproj? Or it only knows en.lproj?
This simply means that iOS would support only two digit language codes (e.g. en.lproj, es.lproj etc.). Whereas Mac OS X will support the format Language_Region (e.g. en_GB, en_US etc.).
I think that information is outdated. They must not have updated the Mac development docs when the iOS changes were made.
When you're creating your Localizable.strings or Project.plist file, you will create one per language or language-dialect. Just create the ones you need.
If you're using Xcode 4, be sure to show the "Utilities" (View-->Utilities-->Show Utilities) when the Localizable.strings or Project.plist file is selected. It will have a Localization section that makes adding these easy.
UPDATE: As of iOS 8 you can now use any language or region in iOS.
Apophenia is correct. Although iOS has 30 languages that it will recognize as .lproj folders, it won't accept any regional codes, so telling it fr-CA won't get you French Canadian, but rather will simply use your French or English strings. The only exception to this rule is Chinese, which should be zh-Hans for Simplified Chinese and zh-Hant for Traditional Chinese.
You should always use the two-letter code for the language (en.lproj, fr.lproj, es.lproj, de.lproj, and so on).
There is a complete (and updated) list of the current supported languages and language codes for both iOS and iTunes here:
http://www.ibabbleon.com/iOS-Language-Codes-ISO-639.html
Note that the iTunes App Store has a different list of supported languages, which makes the chart linked to above very handy!

iPhone support Multiple Languages

In my project, I need to support the Korean language. How is it possible - can anyone explain briefly with example, whether it is possible or not?
It's certainly possible.
You just tell Xcode to add a Korean localization to any of your application's localizable resources that need to change for that language. (Localizable resources include strings files, xib files, and potentially any images containing text.) Xcode will create a copy of your existing English resource, which you can modify and replace with a Korean-language equivalent.
Then when your application is run on a device with Korean set as its preferred language, iOS will automatically use the Korean resources intead of the English ones to present the application's user interface. If you have used good localization code practices (such as using NSLocalizedString to reference strings you present in the user interface) you shouldn't have to change any of your code to support different languages.
Check this guide on how to localize your apps for iPhone: http://www.icanlocalize.com/site/tutorials/iphone-applications-localization-guide/

iPhone: localization / internationalization default strings file

I currently have two supported languages: English and Spanish. Thus I have two main.strings files for each language. One in en.lproj and one in es.lproj.
What I want now is that the English main.strings is the default file if a user with a locale other than en or es arrives at the application, e.g. de or fr.
I know I can set it manually for each string in the code with the defaultString parameter:
NSLocalizedStringWithDefaultValue(key, #"main",[NSBundle mainBundle], defaultString, comment);
But I would prefer to not enter it there again (and have to change it at two places), but rather have the en main.strings file as a default for any other "unsupported" locale.
What I want now is that the English
main.strings is the default file if a
user with a locale other than en or es
arrives at the application, e.g. de or
fr.
Did you try that? I’m almost certain the application will fall back to the English locale without you doing anything at all. Even the system dialogs will come up in English unless your application explicitly supports the current locale.
If you want to avoid this long syntax, I have another solution posted here
Localizing strings in iOS: default (fallback) language?

iPhone Localization Korean, Japanese Codes

How do I find the localization codes for Korean, Japanese, German?
I want to localise my app in these languages. Does it matter what code I use in Xcode?
When I add a new localizable.strings file? There's an option "Add new Localisation". Korean & Japanese are not listed. Does Xcode need a specific localization code for it to work?
Actually, Japanese is "ja" not "jp"
I originally made this mistake as well.
You may find this list helpful for finding country codes:
http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
For German use: de
For Japanese use: jp
For Korean use: ko
You can create the ".lproj" folders manually and then add the files from those folders by dragging them to the resource group in XCode.