4 ms·
Ask HN: How do you internationalize an app?
I recently watched this old video from Computerphile on internationalization: https://www.youtube.com/watch?v=0j74jcxSunY
It explains some of the complications of internationalization.
How do you handle different languages when you internationalize your app? Do you remove all strings from your code that might be displayed to the user and instead reference a separate language file containing all application text? Is this stored in a database? Or as a plain text file (e.g. XML)?
And how do you handle the common situation when sentences do not map one-to-one across languages due to plural or numeric rules? (Example: language A uses a sentence with a single form to express a message. Language B requires two or more forms of a sentence to convey the same meaning.)
If you have implemented internationalization before, any tips, advice (or war stories!) would be much appreciated.
- dlivingston 7y agoIt's going to depend on the platform, but this is a good tutorial for iOS localization [0]. Effectively, it's going to look like: let alertTitle = NSLocalizedString("Welcome", comment: "") let alert = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: UIAlertControllerStyle.Alert) and the localized .strings file will look like this [1],[2]: "Welcome" = "Bienvenido" [0]: https://medium.com/lean-localization/ios-localization-tutorial-938231f9f881 https://medium.com/lean-localization/ios-localization-tutori... [1]: https://cdn-images-1.medium.com/max/1600/1*EjF2SGh4kRQSnbmke4BlRQ.png https://cdn-images-1.medium.com/max/1600/1*EjF2SGh4kRQSnbmke... [2]: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html https://developer.apple.com/library/archive/documentation/Co...