Skip to content

s-blais/scrumdinger-localized

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scrumdinger – Localization Experiment

Hello! • ¡Hola! • Bonjour!

This repo is my experimentation with localizing an iOS app (this app is created as part of the Apple Developer Develop Apps for iOS tutorial). Note that localization of this app is NOT in any way part of the tutorial; I figured it out how to do it by reading the Xcode documentation and a handful of articles. It's a very simple implementation of localization, nevertheless, success!

Download the project, open the Scrumdinger.xcodeproj with Xcode. Then, either:

  • In iOS simulator, Settings > General > Language & Region: change to ES/Español or FR/Français, then hit the Build&Run button in Xcode.
  • in Xcode, choose Product > Scheme > Edit Scheme. Select the Run scheme action in the left column, then Options on the right. Choose Spanish or French from the popup menu; Close; hit the Build%Run button.

Some Notes:

  • Got ES and FR localizations working (Disclaimer: translation accuracy not guaranteed!)
  • The biggest speed bump in this exercise for me was incorporating interpolated values into the localized strings. Although I was able to convert the strings with a single interpolated value in DetailView and EditView to an NSLocalizedString to pass the value with the string key, I solicted a hint from the helpful @cambardell to nail down the correct syntax to pass two values for the "Speaker [x] of [n]" string in MeetingFooterView.
// DetailView.swift  
Text(String(format: NSLocalizedString("meetingLength %11d", comment: ""), self.scrum.lengthInMinutes))  
// EditView.swift
Text(String(format: NSLocalizedString("meetingLength %11d", comment: ""), Int(self.scrumData.lengthInMinutes)))
// Localizable.strings EN & FR, ES
"meetingLength %11d" = "%11d minutes";  
"meetingLength %11d" = "%11d minutos";

// MeetingFooterView.swift
let localizedString = NSLocalizedString("speakerXofN", comment: "")
return String.localizedStringWithFormat(localizedString, speakerNumber, speakers.count)
// Localizable.strings EN, ES, FR:
"speakerXofN" = "Speaker %d of %d";
"speakerXofN" = "Orador %d de %d";
"speakerXofN" = "Orateur %d de %d";

This is fun, and I'd love to learn how these localizations are implemented on a larger scale.

Home Screen EN Home Screen ES Home Screen FR

Detail Screen EN Detail Screen ES Detail Screen FR

Timer Screen EN Timer Screen ES Timer Screen FR

Edit Screen EN Edit Screen ES Edit Screen FR

History Screen EN History Screen ES History Screen FR

About

Experimenting with localization of an iOS app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages