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
- A simple design in Sketch
- Setup Github
- Layout Storyboard, put together the basic App in English
- Add localized strings
- 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.
- Add localized images. Use the “Localized String” approach to localize images. (The asset image does not support localization so well).
- 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.
- Add localized audio files
- Refine Autolayout to support multiple devices
- Other use of NSLocalizedString & best practice — > check next time
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
- Internationalization and localization of Apps in Xcode 6 and Swift http://rshankar.com/internationalization-and-localization-of-apps-in-xcode-6-and-swift/
- How to record audio files in Mac: http://www.mactip.net/how-to-record-sound-on-a-mac/