I have approximately 15 languages in my app, so i have 15 files like this: localizable.strings(language name)
All they have one source, and difference is only in right part of expression.( Ex: "NoMoney" = "Free" in localizable.strings(English) and "NoMoney" = "Gratis" in localizable.strings(Italian) and so on)
Is there any way to update all these files when I update source localizable file (It's localizable.strings(English) file )? Thanks.
In my project, I use Twine to maintain .strings files for many languages and it works pretty well. It allows to store translated strings for all languages in one "master" file and then generate appropriate .strings files for each language.
Related
I am currently working on a simple tower defense game for iOS (using objective-c), which contains several maps/levels. However, as it is now, each map consists of an image file and a .plist file with information. My question is: is there any way I could create a custom file type (for example, *.map) that contains both the image and the information from the plist?
If this is possible, how do I implement this?
Thanks in advance!
You have several good choices for that:
The simplest solution would be grouping the related files in subfolders: rather than having xyz.map file, you could have an xyz sub-folder, and reference the files out of it. You would not need to use any additional libraries for this, and you would be able to use the same name for all your image files and all your level files, because they would be in separate folders.
You can make a zip archive with the files that you would like to combine, and unzip it before use. Here is a link to an answer referencing a library to do it.
You can use a tar format - here is a list to an answer referencing a library that supports it. You would be able to use tar utility on OS-X to group images with plists on your workstation.
Finally, you can define a format of your own: store the length of the first file in the first four bytes, then store the content of the first file, and then the second. You would need to write a utility for combining the two files into one. This sounds like the hardest choice to implement.
So, in my project I have 10 languages, and 10 Localizable.strings files.
I just created Localizable.strings files, a file for each language. Now they contain "key" = "value" pairs, and both keys and values are in English (default language).
My languages are all translated and stay in Excel files.
The question is, how can I insert all my languages in those files faster than just copying each word manually or writing a script for that?
Maybe there is a existing tool for this already?
Thanks.
I found an easy way to compose localizable.strings files from Excel documents.
In the Excel document, in specific columns I insert " " = " " symbols. It's easy to do for all the words by dragging Excel cell down from the corner, so that it copies stuff from that cell to all the cells you drag it to. (sorry for messy explanation)
Thus the document contains the same symbols and words as localizable.strings does.
Than I just copy everything to the text file, remove tabs, change extension to .strings.
(no comments saved unfortunately).
EDIT:
You can copy the stuff from Excel to Sublime Text, then Find & Replace tabs if any. Copy resulted stuff into proper Xcode .string file.
One application that will really save you a lot of time by automating and streamlining localization procedure is Localization Suite. I do not know if they support importing from excel (to save you time transferring your string pairs) but it's free and seems like a complete solution.
I had an internal script at work for doing that tasks in iOS and Android, and I've just opensourced it as a Gem. You can take a look at it here: http://github.com/mrmans0n/localio
It can open spreadsheets from Google Drive and local Excel files as well, like requested.
You just would have to install the gem
gem install localio
And have a custom DSL file in your project directory, called Locfile, with the info referring to your project and the localization files. An example in your case, where an Excel file is used, could be as simple as:
platform :ios
source :xls, :path => 'YourExcelFileGoesInHere.xls'
output_path 'Resources/Localizables/'
The .xls file should have a certain format, that probably is very similar to what you have right now. You just have to clone the contents of this one and fill it with your translations: https://docs.google.com/spreadsheet/ccc?key=0AmX_w4-5HkOgdFFoZ19iSUlRSERnQTJ4NVZiblo2UXc
Hope this helps.
Here are the steps i followed:
change the extension of .strings to .txt on windows
open excel and go to File > Open
Choose the file to open. This should present an import wizard
Follow the steps and specify the delimiting character as =
You're done
I'm using NSLocalizedString() for all localization stuff. The project is very big. We support many languages. Is there a way that I can easily extract strings that are not in the Localizable.strings but were wrapped with NSLocalizedString.
Example.
Let's say I have somewhere in my code:
NSString *message = NSLocalizedString(#"Sample message");
But developer forgot to put this string in Localizable.strings files, so it won't be translated. Is there a way to extract untranslated strings from the source code?
Also, I don't want to use genstrings tool. I already have a very big NSLocalizable.strings files. genstrings tool generates a new one with all strings wrapped with NSLocalizedString removing all former translations, which I do not want. I just want to extract untranslated strings and NOT ALL the strings marked with NSLocalizedString().
Thanks,
Rafal
Check out the genstrings tool, that does exactly this.
EDIT:
Try merging the genstrings generatet strings file with your existing one using the FileMerge tool in XCode (XCode > Open Developer Tool).
Generate Localizable.strings from XCode project http://xcode.fabriziobernasconi.it/
Is there a tool that will extract strings from my source code, and replace them with constant names so that I can auto-generate the strings file I need to translate?
Or do I need to search my project for #" and evaluate each string to see if it should be localized, and then move it by hand to a strings.h file?
I have read about two tools to help localization:
ibtool, to deal with xib files
genstrings to generate a strings table
As far as I know, both are included in Mac OSX, but I didn't use any of them.
I have run Externalize Strings in Eclipse that generated a messages.properties.
That was translated to some other languages and the new files were created like messages_de.properties etc.
Now after adding some new strings how could I externalize them to all messages file?
If I simply run Externalize Strings again then it will update only messages.properties file
and therefore there will be inconsistency among the language files.
To my knowledge, no, you cannot from the "Externalize Strings", translate a word into multiple locale.
The best way to mitigate that is to have some file diff tools ready to show you what new lines exist in messages.properties which do not exist in other messages_xx.properties.