A problem comes when I add chinese,simplified to localization - ios

I want to add chinese, simplified to localization file and a message shows:
“Localizable.strings” couldn’t be copied to “zh-Hans.lproj” because an item with the same name already exists. To save the file, either provide a different name, or move aside or delete the existing file, and try again.
There is not chinese, simplified in the list and I just can't add it. By the way, other languages works fine when I try to add them.Anyone know how to deal with it?

I find the reason at last. Maybe my colleague add the chinese, simplified before and he didn't delete the file in the project but just delete the cell in the list. After I delete the chinese, simplified file in the project, it works fine.

Related

Internationalise Authorisation Sentence in XCode

I want to internationalise the comment used to give more details about a required authorisation.
My whole project already use a Localizable.strings and everything works fine.
But I can't get to make it works with these sentences located here:
Am I missing something here? I already tried to add a simple word, that is translated in the Localizable.strings but no effects on it so far :(

Create a plist outside Xcode?

In our app we have lots of photos that we need to read while using the app, we have to also orgenize them into groups/categories.
this option is to make a plist with their names, and just put them into the app and read the plist.
create folders inside the app, order them inside, and read the specific folder.
Option 2 took me days and I couldn't even make it work reliably, and it also seems not the right way to work for some reason.
Option 1, the problem is that if you have 100 files you have to edit your plist every time again for a new file you add.
Is there a way to make option 1 outside of xcode so I can put all files in a folder on my mac, get their plist, and put this plist inside Xcode ?
What's the right way to achieve this ?
plist is just a simple XML file. You can create the plist file and add to xcode as any normal file to the bundle and read it.
macOS comes with two command-line tools for manipulating plists:
/usr/bin/plutil can convert a plist between formats. You might like this because you could write your photo catalog in JSON using whatever tools you like, then convert it to a plist. Of course, then you could just use JSON directly in your app…
/usr/libexec/PlistBuddy (note that /usr/libexec is not normally in one's PATH) can modify a plist in place, adding, removing, or changing entries.
Both of these tools have man pages (man plutil, man PlistBuddy) and substantial built-in help (plutil -h, /usr/libexec/PlistBuddy -h).
First, you're making a false assumption. There is no need to use a plist file here. An ordinary text file listing the names will do just fine, and you can just make up your own format to dictate groups and suchlike. And that sort of file is trivially easy to maintain.
Second, your rather confused claim that "Option 2 took me days and I couldn't even make it work reliably, and it also seems not the right way to work for some reason" is just a cop-out. Folder references are not a difficult thing to use (you can configure them in the Finder, which is as simple as you can get), they do work just fine, and they are a perfectly reasonable solution here.

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.

iOS: Deleting localized string files in an update

I have an application in the App Store with the string files localized. The thing is I want to submit an update with the string files only in english,but when I install the app from xcode(only with the string files in english) in a device that has already the application installed(from the App Store) I can see the strings in other languages than english.
If I install the app in a device without the application already installed I can only see the strings in english,regardless the selected language on the device.
I know one option is to change the name of the string files,but I was wondering if there is a smarter way of doing this.
Thanks a lot
The problem is likely that your old localised.strings file is still hanging around in a different location. When you add or change languages using localisation, the strings file may be moved to a different folder. When the delta update occurs it obtains the new strings file, but fails to delete the old one because it's in a different location. However that location is higher up the search tree, and so gets found first when the app looks for a string.
One potential solution, though not a nice one, is to rename your localized.strings file to something different, then use the localizedStringFromTable command in all places you previously used localizedString, naming your new file as the table of origin. It's not a pretty fix, but it should work.
Another potential solution if you only need one language is to ensure that the strings file is stored in exactly the same bundle location as the one in the previous version.
I solved the problem with this line in the file main.m, right before calling to UIApplicationMain():
[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObject:#"en"] forKey:#"AppleLanguages"];
Basically it forces the app to be available in English only.

Localize Wix Bundle Bootstrapper

I localized file hyperlinkthemt.wxl (pl-pl). But my bootstrapper just shows up and then disappears in a second and nothing more happens. I was trying to solve the problem and noticed that I can't use polish letters in hyperlinktheme.wxl.
Is there any way to change that. I was trying to do something with HyperLinkTheme.wxl:
<WixLocalization Culture="pl-pl" Language="1045" xmlns="http://schemas.microsoft.com/wix/2006/localization">
but it didnt help. As you may know for bundle projects one can't change localization.
There will be a log file in your %TEMP% folder that should show a little more detail what is wrong. Chances are the .wxl file is not saved in UTF8 and cannot be loaded.

Resources