NSLocalizedString not working for some word - ios

I have english, Japanese, korea Localizable.strings file. I cannot load some word from korea file. I have checked spelling, capital letter or small letter also. It is correct. I have cleaned project, reset simulator and delete app on device also. It is not working for some words. May I know how to do?

A common problem is this: If there is an error in your localisable.strings file, anything after that error will be just ignored. The line that you are checking may be fine; if the line 10 lines above is broken, it won't work. If that is the problem, for example the item in the next line isn't going to work either.
Cleaning project, reset simulator, delete app on device, are all not going to do anything for you.

Also it may be some words, that repeats. If two same keys in Localizable.strings - it may be work not properly.
Also i found, that continue key make some bugs, so i changed it to CONTINUE.
HINT something like continue_question and anything that contains continue - makes same bug.
It seems like there are another words like this. Also got to say, that i didn't delete app and clean build folder due to debag this. In Xcode 7.3 it was't necessary.

It might also be due to a blank space in one of your empty lines in the Localizable.strings file.
It's tough to spot but you can spot it by looking at which point of the file the strings start to fail localization.

Check or search for # in your localizable.String .if there is any remove it . the key value pairs below the # are not working

Related

This bundle is invalid. The Info.plist file is missing or could not be parsed. Please check it for embedded control characters

Please help me out with this issue while uploading application to Appstore I am getting this error:
I experienced similar issue recently - messed with a lot of different things but at the end, the issue was a bad character in the file - which is only visible through an editor like vi. Open the file with vi and then navigate to the bad character if you find one (it usually sticks out like a sore thumb as a different color to the rest of the file) - then hit 'x' to delete it. The type colon on keyboard and 'wq' and hit enter to save and exit. Delete previous archive - archive again and try to validate. This worked for me.
I had the same issue & I wasted full day looking here and there creating builds and validating them.
I checked my Info.plist file & there was no control character.
One property CFBundleShortVersionString from Info.plist was referring to $(MARKETING_VERSION) which had the control character. So kindly check the Info.plist file first and then the referencing variables.

Xcode 9.2 crashes exporting or importing xliff

I can see that this is a recurring problem with all sorts of Xcode versions. I'm using the latest non-beta build (9.2 9C40b).
I have already localized in Spanish. Doing that involved successful exports and imports of xliff files, with same Xcode. So what changed?
I am now trying to localize to another language. This is a showstopper. Any hints? I have looked through all the posts about previous versions crashing, and have not found anything that works.
(And before you mention it, I am done and over with genstrings. If it exists anymore.)
I've discovered that large .xliff files (more than about 6,500 lines or 1,200 <trans-unit> elements) cause Xcode 10.1 to crash consistently near the end of an import operation.
The work-around is to manually split the .xliff file into two distinct .xliff files, each containing a subset of the <file> elements in the original file. You can then import the two resulting .xliff files into Xcode separately without crashing.
Do not translate "bundle name"
I wanted to translate to Greek Language and every time I was importing xliff files, Xcode was crashing.
I realized that the problem was, that I was also translating "bundle name".
If you did the same mistake, open xliff file, find:
<trans-unit id="CFBundleName">
<source>NameOfYourApp</source>
and delete the line
<target>...</target>
After that everything worked perfect for me!
Here's a workaround. Select your project icon in the Project Navigator. Select Info at top (as opposed to Build Settings). Under Localizations, click the + button and add your new language.
Xcode will create the new .strings files and fill them up with pre-existing translations. (If there are any.) Strangely, for me, some of the new .strings files were filled in with English, some with Spanish.
In any case, you have the new .strings files and can manually paste in the translations for the new language. If your app doesn't have too much user-facing text, this isn't onerous.
But really, with this problem going back to Xcode 4 (!) one would think it would be fixed by now.
it's a late answer I know, and I'm using Xcode Version 10.1 (10B61) already.
In my scenario, I added Chinese Hong Kong (zh-HK) language under Project > Info > Localization and exported successfully then sent to the agency for translations. After few days they sent to me Chinese translated text within. At that point, everything seems correct for me by eye. But I've tried 10 times to import file and it crashes 10 times without exception! Which makes me sick. I use to checked to see the difference between 2 document via Apple's File Merge App. I understand that agency geniuses added few missing <\target> tags. Hmmm, that means while exporting Xcode didn't add for some translations <\target> tag. Interesting...
I removed those unnecessarily translated tags and checked everything was equal in 2 documents except translations of the words to the Chinese language.
Tried to import again. Then BOOM! It works like a charm! I was surprised by this. It's so weird that Xcode never shows me a descriptive message about my mistake. Probably, It's just a parse error for Xcode.
Whatever, I hope this will work for someone else.
Best.

Storyboard localization excludes a single file in iOS

I am facing a very obscure issue.
I've got an app that needs to be localized in three Languages, English, French, German. There's multiple localization files as I've got multiple storyboards ( each storyboard has one for each language).
Everything works great and things translate properly except for ONE file in ONE storyboard in ONE language. So this specific storyboard I call "Authentication" works for all languages except for the German one.
I've checked. the file is:
included in all targets
is also found in Build Phases copy phase
has the correct name.
has the correct formatting (in fact i am not allowed to build at all if the formatting is not correct in this version of Xcode.)
I am out of ideas and resorting to asking here to see if theres anything i might be missing in my series of checks.
Thanks all
SOLVED.
The answer lies within my third point
has the correct formatting (in fact i am not allowed to build at all
if the formatting is not correct in this version of Xcode.)
Beware everyone. This might seem like it is the case but it does not apply to everything. If there's a syntactic error in the Localizable.strings file, xcode will let you know and refuse to build.
HOWEVER if there's a syntax error in the YourStoryboard.strings file, the process of building will go on UNHINDERED.
Since an issue in syntax was halting everything for Localizable.strings i was wrongfully assuming that such a check would take place for all translation files. It doesnt!
Hope this saves someone in the future

Xcode - Invalid character in source file (Replace " " with " ")

I have a question about Xcode (Swift). Sometimes when I write an if statement. Something like this:
if(a == 2){
//do Sth
} else {
//do Sth
}
Xcode throws me an error: "Invalid character in source file"
I know it is no big deal and fixed by clicking on "Fix-it" but I want
to know what is the problem. That doesn't make sense to me...
My Xcode is on 7.2 and I am using Swift - I don't know if this is just a Swift problem.
For me it's the ESC key - it's completely reproducible! If I go to search and hit ESC in the search window I also find the occurrences marked - and can replace those with nothing. But it's not shown even with "Show invisible"!
final solution: Bind ESC keybinding to "Cancel". It's that simple.
I was having this problem. The way I solved it is by 1) copying whatever you have into Sublime Text or another code editor and having a look (you may need to enable viewing hidden characters). Mine had a code in there DC2 which is some sort of ASCII control character. For me it was caused by the fact that I had put the playground into manual execute and bound a keyboard shortcut to it that seemed to be entering that control character every time I executed it using the shortcut. I just changed the shortcut and removed the ASCII characters as I was able to see them in Sublime Text. (The link in the comments to the OP concerning left to right mode made no sense and didn't work for me.)
I encountered this problem when I was using a non-Apple keyboard with my iMac. Probably your case too. They add unnecessary control characters! One way to fix it in Xcode ischoose from the menu Editor>Show Invisibles and see if there are any unwanted characters where the error is being thrown and remove them.
Editor->Show Invisibles did not show the character that was causing a problem for me. No-break-space (u00a0) will be shown as a space with no "dot" indicator. However, that's really hard to see and I completely missed it the first time. Zoom helps.
One way I found to detect invalid characters is to use Visual Studio Code and enable the settings:
"editor.renderControlCharacters": true
"editor.renderWhitespace": "all"
This has the same visibility issue with no-break-space as Xcode, however it does show other special characters.
To make it more obvious and possibly detect more invalid characters, install the extension "ascii-unicode-escape" and follow the instructions.
I don't understand why Xcode allows these invalid characters, inserts them into your source files for no reason, and doesn't even give an option to detect them! I'm trying to write code, not secrets in invisible ink, damnit!! I guess it's less of an issue for compiled code, which will show an error, but not so convenient with shader code.
I'm having the same issue. I found a solution after extensive testing. Hopefully it could save others extensive hours of researching into this terrible Xcode experience.
The problem is I have a FILCO Minila keyboard, which has the 'App' key right next to 'left arrow'. I would accidentally hit 'App' when typing really fast, and it enters a 'DEL'(Data Link Escape, Unicode 0010) invisible character. It could only be seen when copy-pasted to Sublime. It's not even visible under Xcode's own 'Editor -> Show Invisibles'(Talking about good user experience...)
Magically this doesn't happen to Sublime or VSCode, only to Xcode. So no excuses for Xcode I guess?
The fix is to download Karabiner, an advanced keymapper for macOS, and invalidate the 'App' key or map it to something else. Karabiner would also invalidate your keymapping in the system default keyboard config. So you would have to remap stuff like 'cmd', 'alt' if you've customized them. If so, be sure to map both left & right modifier keys in Karabiner, because according to Karabiner's key event viewer, the system default keymap would map left_alt & left_cmd to right_cmd and right_alt... Just annoying as hell...
It took me 2 months to realize this problem and 2 hours to actually find out it's the 'app' key that's the culprit and fix it.
I'm using XCode 10.1.
With Xcode: Xcode does not help even after showing invisibles.
Then you can copy the code to Sublime Text => you will see these invisible characters which are the <0x0f>. Click the image to see in details.
With Sublime Text 3, it works!
=> Then you know where to remove the redundancies. Hope that helps!
Are you using the option ⌥ key for any keyboard shortcuts? This was my issue. It seems combining the option key with other keys can insert hidden characters.
For me, this happened when I used the ⌃+⌥+p shortcut in Xcode to resume the SwiftUI preview canvas. It added a 0x10 character. I discovered this, as other posters have recommended, by pasting the code from Xcode into Sublime Text.
(NB: I should have been using ⌘+⌥+p).

IOS Application Loader error "Unable to Parse application Info.plist for validation"

After cleaning everything in Xcode to Submit my app to iTunes Connect, I've reached an error that I cannot find an answer for.
The full error is:
Unable to Parse application Info.plist for validation. Please make
sure your Info.plist contains no embeddedcontrol characters, is del
formed, and is encoded in a UTF-8 compatible encoding.
Im creating the project with UNITY 3D, and everything works okay on my iPod and iPhone, but after I build it to archive and submit either from Organizer or Application Loader I get this error.
Can someone please Help??
I had this error, and it turned out to be an inadvertent space in one of the fields. But the key to resolving these errors is to view the info.plist file in a text editor. By careful examination, you are likely to be able to find the non-conforming character/field.
It's probably a BOM character or something else you can't see.
Try converting the document to UTF-8 without BOM
Also, make sure your line endings are all \n (LF) and not \r\n (CRLF). That should fix it.
I'm not sure what text-editors you have, but you can do this with TextWrangler which is Free.
Another possibility is that you have some other special character (like an & or < or >) that it doesn't like, but I'd suspect this isn't the case.
Try opening your Info.plist in a plain text editor and look for characters that may be out of place. If you have other similar apps, you can compare both plain text .plist files which may lead you to the problem.
Oddly enough, I had a project which exhibited this very error and in my case, swapping "Icon Files (iOS 5)" for the predecessor "Icon Files" made the difference. Remember that the older Icon Files requires the icons to be of the standard naming conventions: Icon.png, Icon#2x.png, Icon-72.png, Icon-72#2x.png, etc.
I can't explain why this change produces the different results which leaves me to believe its a bug in Apple app validation.

Resources