I wanted to start something that is related to 3D perspective with Sketch today but somehow I got interested in App Internationalization while watching a little WWDC video. So I decided to build a simple multi-lingo app to test some ideas.
I was excited about the possibilities of the app functions and got really excited. But I am also fully aware of my skills and knowledge level.
Thoughts
  • The App will not be complicated but enough to demonstrate the fundamentals of internationalization
  • Greetings in different languages should be fun
  • Maybe some audio greeting as well
  • There are many others things that I can do, but this is literally my first mini App with Swift. I should just focus on the core value of my project today which is to learn iOS internationalization basics
Objective
  • Learn internationalization of Interface strings, programmatically generated strings, image assets, audio files
  • Learn how to handle translation files
  • Learn Sketch export to speed up development
  • Preview and debug in translated languages
  • How to process right-to-left language
Steps
  1. A simple design in Sketch
  2. Setup Github
  3. Layout Storyboard, put together the basic App in English
  4. Add localized strings
  5. Process the translation file. Personally I found Brightec.com quite useful and handy. But with this project, it’s not necessary. All strings can be easily added via Xcode.
  6. Add localized images. Use the “Localized String” approach to localize images. (The asset image does not support localization so well).
  7. Programmatically switch language and region. First I thought it was too much trouble. Normally users can do it from the system setting. Later I found a solution in Stackoverflow.com which is to  get files from the respective language folders.
  8. Add localized audio files
  9. Refine Autolayout to support multiple devices
    1. Other use of NSLocalizedString & best practice  — > check next time
sketch design  (quite different from the final result )how nice sketch support folder exportXcode manages image assets very nicelyfirst version in englishmy headache in landscape viewautolayout and constrainsApp in my mother tongue second version with multi-lingo support
Lesson Learned
  • Autolayout is such a headache and I spent a lot of time adjusting different devices, landscape and portrait. I had to give up landscape option at the end. I can shift locations, but simply too much to manage the compact height. Next time if the project is easy, perhaps I can quietly sit down and adjust one by one.
  • Sketch made the export process like an easy breeze.
  • Somehow Xcode can not located the m4a file that I recorded with Quicktime player. Mp3 files are ok. Later I learned that m4a files don’t get automatically copied to Build Resources. Need to add manually.
  • In Xcode 6, you can actually export and import XLIFF (https://en.wikipedia.org/wiki/XLIFF) files
Nice-to-have functions for the future version:
  • Add right-to-left support // good to have with more complicated layout.
  • Show progress when playing the audio
  • Add an audio database with different audio samples.
  • Users can listen to a group of audio samples in one language
  • Allow users randomly submit language audios
Bug needs fix:
  • Showing nil when adding additional ViewControllers.
Further Reading