Giter Club home page Giter Club logo

scrumdinger-localized's Introduction

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

scrumdinger-localized's People

Contributors

s-blais avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.