German localized string appears in English - ios

My problem is very odd. I am developing an app in 6 different languages (including English and German) and I have localized every single string within the project. Therefore, some texts in the app display in English instead of German.
This happens only for German and always for the same texts. I have run a search of the English strings that shouldn't appear and it is only in English localization files (base files). I clean the project, checked the IDs of the Labels, and anything else. Nothing worked...
Did someone went into a similar issue ?
EDIT: If I try playing with ordering my strings in the German strings file, then I can get the right translations ! But some others won't work anymore.... It looks like a big bug from xCode but it's totally messing up all the project !

Please check you file with your localised strings in German and check that keys are the same you asked in LocalizedString() for that labels.
It happens when LocalazedString doesn't find string for German locale and return it for default locale (English).

Finally found it. It appears that a character has been somehow inserted in the end of a commented line. This character then appears as a comment in xCode, but it is not. Finally, at runtime all translations in lines after this unwanted token will be ignored.
xCode will not help you nor give any warning about it....

Related

Xcode English Localization doesn't use Main.String(english)

I have three Localization in my App,
Chinese,Japanese are worked perfectly, included Localizable.string and Main.string
..English have a weird problem, Localizable.string(english) works perfect,
the NSLocalizedString(:) show exactly right String which in Localizable.string(english)
but UI still show the content of my Main.Storyboard(Base) which is chinese,
the Main.String(english) didn't work at all.
I have removed Main.String(english) and localization it again, still not working

iOS App name displaying as $PRODUCT_NAME in simulator since starting to localize my app

I've just started to internationalize my app with NSLocalizedStrings, ready to localize it into French, German, and Italian. I've got no translations done yet so just make some dummy translations to convince myself that its working ok.
I'm still just working in the simulator and change its language to French to have a look at my dummy translated strings.
When doing so I notice that my App actually gets called $PRODUCT_NAME in the springboard, under the app icon. This is only when in non-english language settings, i've been testing it in French as described.
The actual strings exported into XLIFFs do include the $PRODUCT_NAME strings, but I just localize them back to $PRODUCT_NAME for all languages, hoping this would keep it evaluating as a VARIABLE look up.
I notice that my app does have BundleDisplayName properties that a small dummy app does not have, perhaps that's related.
Should I just stop the display name being tied to $PRODUCT_NAME, which itself is tied to $TARGET_NAME and explicitly write it out as my AppName... just feels odd having to do so. I was probably thinking of leaving my AppName as unlocalized so that i can have more of an identity across territories, though I don't know if this is a good thing or not.
Would be good for now if i could just make the app icon behave consistently with $PRODUCT_NAME being evaluated rather than being output literally in non-English languages.
Thanks for your time

Localization not working on Xcode

I can't get my app to work with localization.
I have created a Localizable.strings file and ticked the languages that I am localizing. (For now I have base, english and spanish.)
Localized storyboard with three languages.
In Project settings > Info I checked Use Base internationalization and all languages are correctly added. (Moreover, beside the language it shows 2 Files Localized, which I guess they must be the storyboard and .strings file.
I am using this example for testing:
self.loginLabel.text = NSLocalizedString(#"login", #"Login text info");
This is how the Localizable.strings (Base) file is looking like:
"login" = "Log in";
However, it is not working and instead it is showing login. Have I forgotten a key step?
BTW: I have tried already changing the login text just it case something was overriding the label.
Those are the steps indeed, I don't think you've left anything out. I usually set the comment to nil instead of another NSString though - not sure if that makes a difference.
However, rather than in only base, make sure you're adding the same line also to the English and Spanish files (obviously translated as appropriate).
Next, for the language to show up, set the device to said language. Close your app and start it again. Strings should now show up in the other language.
Note that the Simulator often has trouble with new translations, especially when they've been added to an already deployed app. In that case, remove the app from the Simulator, click on Product - Clean, and re-deploy.
In my case, it didn't work because the UILabel text was set as "Attributed" instead of "Plain" in the Attributes Inspector.
Localization with a .strings file doesn't seem to work on Attributed strings.
I even had a storyboard with mixed Plain and Attributed string labels, and the localization only worked on the Plain ones.
For anyone having a similar issue in the future:
Check if your *.strings file has any non-printed characters.
I used JavaScript for a simple task and didn't realize it included some whitespace characters.
An easy way to check is to put the translation at the top of the file and see if it works. If it does, there might be some whitespace characters. The next steps are... binary search and remove the whitespace characters.

Localization for a very simple app.. How to connect a button?

I have a very simple app which only contains a PickerView, UILocalNotification, UIAlertview and less than 8 views. What I want is:
I have a main view which contains two buttons one says English and the other says French.
What in my mind is:
When the user hits English it'll take him to the Project I have right now,
However, when the User hits French it'll take him to a duplicated views that I'd simply and manually change and translate it's labels into French.
** Now my question is ** how do I translate the PickerView, LocalNotification and the AlertView? and how to connect the French button to these translations?
From what I've googled and read here in SO is that I can get the strings out and list them into Localizable.strings but I still don't know how to make my french button ask for these strings? Also, is there an easier and simpler way? any idea?
Thanks,
Kindly try this for doing localization
http://www.raywenderlich.com/2876/how-to-localize-an-iphone-app-tutorial
For buttons use something like this
[self.yourButton setTitle:NSLocalizedString(#"YOUR_KEY", #"Comment") forState:UIControlStateNormal];
Do not duplicate your views and view controller just for the sake of localization, considering that for both languages have the same layout and everything only thing that would change is the language. So add English strings and French strings to your project and use NSLocalizedString to get these values.
Note:NSLocalizedString works with device language only so if you want to change the app's language manually try this. I have used AMLocalizedString in many of my projects and they work fine.
Hi as you want to make it localized only at App basis not at device basis hence NSLocalisedString will not work you have to manage it so you have to take two different files and you have to fetch the string value on the basis of selected language. In similar manner as LocalisedString works as in localization there are multiple .strings file created for languages and it works in a way to select default language of the device and shows the text from the localised file.

Blackberry Hindi and Gujarati text display

I want to develop a blackberry application that supports multiple languages, such as English, Hindi and Gujarati. I have tried using utf-8 characters but it displays "??????" for Hindi.
I have try also i18n but there are not possible to write in Hindi in property file. have any idea.
The device needs to have the appropriate fonts installed to display different languages. So you would need to make sure Hindi fonts are available. It sounds like they aren't. Try going to a hindi web page, and see if the characters display correctly there.
For the resource bundle, which I think is what you mean by 'i18n', the compiler forces you to use the default java character encoding. If you're on Windows, this is CP1252. To get characters outside of that encoding, you use the Java unicode escape, which is the four digit hexidecimal encoding of the unicode code point, prefixed with '\u', such as '\u00f3'. The Eclipse editor will do this for you automatically, but if you are editing the file with another editor, this escape encoding will be required.
Make sure you are testing your code on an actual device, and not just the simulator. I learned this the hard way. I spent many hours trying to figure out why my translated text was showing as "?????", and once I tried it on the actual device, the translations showed with no problem (japanese, chinese, russian, arabic, etc).

Resources