Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to make your app international

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →

How to make your app international

In Japanese

Avatar for Yusei Nishiyama

Yusei Nishiyama

November 18, 2016

More Decks by Yusei Nishiyama

Other Decks in Programming

Transcript

  1. struct CountryCodePredictor { static func inferredISOCountryCode() -> String? { return

    countryCodeFromNetwork() ?? countryCodeFromLocale() ?? nil } private static func countryCodeFromNetwork() -> String? { return NetworkInfoUtils.isoCountryCode() } private static func countryCodeFromLocale() -> String? { let locale = NSLocale.currentLocale() return locale.objectForKey(NSLocaleCountryCode) as? String } } class NetworkInfoUtils { // Check MCC class func isoCountryCode() -> String? { let networkInfo = CTTelephonyNetworkInfo() let carrier = networkInfo.subscriberCellularProvider if let carrier = carrier { return carrier.isoCountryCode // ISO 3166-1 } else { return nil } } }
  2. ϦιʔεϑΝΠϧ΁
 ௚઀ΞΫηε͢Δ private func LocalizedString(key: String, tableName: String? = nil,

    bundle: NSBundle = NSBundle.mainBundle(), value: String = "", language: Language) -> String { if let path = NSBundle.mainBundle().pathForResource(language.ISO639_1, ofType: "lproj"), bundle = NSBundle(path: path) { return bundle.localizedStringForKey(key, value: value, table: tableName) } else { ʢলུʣ } }
  3. ํ޲Λ࣋ͬͨཁૉͷ൓స private var titleLabel: Label = { let label =

    Label.newAutoLayoutView() label.textColor = UIColor.cgu_greenColor() label.flipIfNeeded() return label }()
  4. export upload translate download import develop feature RC desc "Export

    xliff file of base locale." task :export do sh "xcodebuild -exportLocalizations -localizationPath . -project Global.xcodeproj" sh "mv #{BASE_LOCALE}#{EXT} #{SOURCE_FILE}" end desc "Upload xliff file of base locale to OneSky platform." task :upload do resp = project.upload_file(file: "#{SOURCE_FILE}", file_format: 'XLIFF', is_keeping_all_strings: false) p resp.code end wYMJGGܗࣜͷϑΝΠϧʹϕʔεݴޠ ӳޠ ͷ
 จݴΛΤΫεϙʔτ w0OF4LZ ޙड़ ʹΞοϓϩʔυ
  5. export upload translate download import develop feature RC desc "Download

    translations from OneSky platform." task :download => TMP_DIR do ACTIVE_LOCALES.each { |locale| file_name = file_name(locale) resp = project.export_translation(source_file_name: SOURCE_FILE, locale: locale, export_file_name: file_name) File.open(file_name, 'w') { |file| file.write(resp) } } end desc "Import translated xliffs." task :import do ACTIVE_LOCALES.each { |locale| sh "xcodebuild -importLocalizations -localizationPath #{file_name(locale)} -project Global.xcodeproj" } end w֤ݴޠຖͷYMJGGܗࣜͷϑΝΠϧΛ0OF4LZ͔Β μ΢ϯϩʔυ wμ΢ϯϩʔυͨ͠ϑΝΠϧΛ9DPEFʹΠϯϙʔτ
  6. ม਺ͷॱং ม਺ͷॱং͕ݴޠؒͰಉ͡ͱ͸
 ݶΒͳ͍ "Copy %@’s %@" = "%@ von %@

    kopieren"; "Copy %@’s %@" = "%$2@ von %$1@ kopieren"; "Copy %@’s %@" = "Copying %@’s %@";