Using this tool, the translation looks like the following: I used a tool called iXLIFF that i found on the App Store which cost 0.99€. So now you (or a translation agency) can start adding the missing information.Īlthough you could as well use a text editor, there is a range of tools available for XLIFF translation. (BTW, for the English translation, you can just copy the comments into the target field.) However (and this is the big difference to previous approaches), if you had already provided a translation, the existing translations will be included in the XLIFF file. If you have not provided a previous English localization, it contains only the keys and comments, not the actual translation. After executing this command, a file called en.xliff will be created containing as well the localization strings of the NSLocalizedStrings and of the storyboard and NIB files. In that example, the command is executed in the directory where the file North Kiteboarding.xcodeproj is located. project "North Kiteboarding.xcodeproj" -exportLanguage en. Xcodebuild -exportLocalizations -localizationPath -project ]Īn example for the creation of the English XLIFF file would be xcodebuild -exportLocalizations -localizationPath. So, I will not cover exporting XLIFF files with Xcode (you will find a good tutorial about that here, if you like), I will rather employ the following command line command found here for each language that needs to be created OR updated: It allows to export an empty XLIFF file based on the base language but as soon as you created and translated an English XLIFF, you cannot export an English XLIFF file including the existing translations. However, Xcode does not allow to export an XLIFF of the base language. Actually, Xcode allows to create (and update!) XLIFF files based on the underlying Stroyboards, NSLocalizedStrings in your code and on already existing localization resources. This means that we now want to create the XLIFF files and translate them in the aftermath. So, let’s assume you encapsulated all your strings in NSLocalizedString pragmas and want to localize your application. Strings in these files will be recognized automatically. Basically, you do not have to do anything to enable their localization. The second kind of files that are translated are storyboard and NIB files. The downside to this approach is that you have to provide a translation for your base language as well (in our case English). The background of this approach is that the default value might change and if you used it in the first parameter and have other translations, this change would break the other translations as the first parameter is used as the key to which the translation of a string is assigned. However, I would claim that currently in the majority of cases the first parameter is used as the key and the second parameter as the default value in the base language (throughout this article, the base language will be English). Usually, the first parameter is the actual string that should appear in the application and the second parameter contains a comment for the translator. The usage of NSLocalizedString is a topic of its own. So, for instance, out of Internet connection" gets Internet connection"). In order to be able to localize your application, you have to encapsulate all strings in your code that appear in the user interface into NSLocalizedString pragmas. In this post, I want to present a (fairly) simple localization approach based on XLIFF. Using XLIFF tools, the localization of Mac and iOS applications is straightforward. XLIFF is a well defined localization interchange format that bundles all localization strings in one file. You can however also jump directly to the solution.įortunately, Apple has decided to include localizations based on XLIFF in the development process of iOS and Mac applications. Read on, if you want to know more about the background and the pre-conditions of my approach. I would rather like to provide a (simple) solution. I do not want to go into detail here because otherwise this post would never end. Especially if you are updating your code and want to update the localization, things get hairy. The tool support by Apple is – friendly spoking – lacking consistency. When it comes to localizing applications for iOS or Mac OS, things get pretty quickly messed up and cumbersome.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |