قالب وردپرس درنا توس
Home / Apple / Michael Tsai – Blog – Modern Location With Xcode

Michael Tsai – Blog – Modern Location With Xcode



Eric Blair:

What makes XLIFF support so interesting to me as a developer is how the files are generated. While Xcode would like to process the base support .strings file, it can also scan your project for NSLocalizedString conversations and generate the XLIFF files right from the code. Once you've crossed the bridge, you no longer need to worry about things that do not match string identifiers or dull update of .strings files because your last update added 12 strings and edited 3 more in 7 different languages. Since XLIFF is a variation of XML, you can also use your favorite XML processing techniques to automate any changes to the file. For example, I sometimes notice dummy strings with a known comment and use an XSL transform to remove them before sending them to my translators.

It's not to say that the XLIFF workflow was painless from get-go. In fact, the XLIFF round trip process did not support string-dictation files to Xcode 9. Moreover, the string-based support was initially limited to the language pluralization rules. It is only from Xcode 1

0.1 that the export and import workflow has been supported for variable width strings with round tripping. Previous version of Xcode not only ignored variable width strings when exported, but failed to respect width variations on import and would overwrite existing width translations.

Additionally, enhanced string support support with variable width supports strings thickness in XLIFF workflow feels now complete. The generation process is aware of the language-specific pluralization rules, and the exported files contain the correct translation requests instead of just mirroring the elements in the string-dictation file of your development language … and yes, you must provide a string-dictation file in your basic language. Unlike the .strings 1: 1 ratio between the identifier and the screen string, NSLocalizedString () call page contains not enough information to synthesize a string dictation entry.

I have long liked to generate keys for NSLocalizedString () calling in code. Blair mentions two tools that go the other way and generates code from the string files.

Earlier: How to use adaptive width strings for location.

Cookie Code Generation iOS iOS 12 Location Mac macOS 10.14 Mojave Programming Xcode XLIFF

] Stay updated by subscribing to the RSS feed for this post.


Source link