Proses Lokalisasi Aplikasi IOS dengan Vivid Money

Halo! Jika aplikasi Anda mendukung bahasa yang berbeda, Anda mungkin mengalami masalah yang terkait dengan pelokalan: kesalahan dalam penulisan kunci, nilai bahasa yang hilang, kebutuhan untuk membangun kembali aplikasi jika terjadi pengeditan terjemahan darurat. Bukan momen perkembangan yang paling menyenangkan, bukan?





Artikel ini akan membahas cara kerja pelokalan di Vivid.Money: kami akan memberi tahu Anda alat pelokalan mana yang Anda pilih, masalah apa yang Anda temui, dan cara pemecahannya.





Untuk pemahaman yang lebih baik tentang proyek secara spesifik, Anda dapat membaca materi ini , dan kami menyarankan untuk memulai artikel ini tanpa basa-basi lagi.





Metode pelokalan mana yang Anda pilih

Persyaratan lokalisasi kami mencakup poin-poin berikut:





  • Sinkronisasi antar platform (iOS, Android, Backend) untuk satu sumber kebenaran;





  • Memeriksa ejaan yang benar dari kunci yang digunakan selama kompilasi untuk menghilangkan kemungkinan salah ketik pada nama kunci;





  • Pengembang tidak perlu memperkenalkan pelokalan secara mandiri untuk berbagai bahasa agar pengembang menghabiskan lebih banyak waktu melakukan apa yang seharusnya - untuk mengimplementasikan fitur;





  • Kemudahan interaksi dengan penerjemah;





  • Kemampuan untuk mengubah nilai kunci tanpa membangun kembali aplikasi.





Apple .strings .stringsdict. .strings (“”: “”), . .stringsdict plural plist. , NSLocalizedString. Apple .





  , : , , , . XLIFF ( , XML), . , - .





, , , . , , , :









Lokalise





Phrase





OneSky





POEditor









+





-





-





-









+





+





-





+





plural





+





+





+/-





+





SDK





+





+





+





-









+





-





-





-





/





+





-





-





-









+





-





-





-









+





+/-





-





-









https://lokalise.com/pricing





https://phrase.com/pricing/





https://www.oneskyapp.com/pricing/





https://poeditor.com/pricing/





Crowdin, . , - , . Lokalise, , . , , .





lokalise , , , . : 





  • ;





  • Fastlane, ;





  • API/CLI;





  • SDK.





Lokalise .





, SDK. : , , SDK. , , .





API, Lokalise , . .





, Lokalise SDK, . : . , Lokalise SDK , , , .





(debug/release), .





.strings .stringsdict plutil (property list utility), : .. Ruby:





def self.valid_bundle?(path)
        puts 'Validating localization bundle...'
 
        strings = Dir["#{path}/Contents/Resources/*.lproj/*.strings"]
        stringsdict = Dir["#{path}/Contents/Resources/*.lproj/*.stringsdict"]
        
        is_valid = true
 
        (strings + stringsdict).each do |path|
          stdout, stderr, status = Open3.capture3("plutil -lint #{path}")
 
          unless status.exitstatus == 0
            is_valid = false
            line = stderr.strip[/on line ([0-9]*)/, 1]
 
            puts "***********************************************".red
            puts "Found the invalid string in file at path: #{path}".red
            puts "The invalid string: #{File.readlines(path)[line.to_i-1].strip}".red
          end
        end
 
        puts "***********************************************".red unless is_valid
 
        is_valid
      end

      
      



Localisation, .





,   - . LocalizationFetcher : . , , - . , , Documents, . 





, , , Localise.bundle. : Documents .lproj Localizable.strings Localizable.stringsdict Localizable.nocache.strings Localizable.nocache.stringsdict, . “Localizable.nocache” tableName localizedString(forKey:value:table:) , .





, : , , , .





R.swift , .., -, , ( ), -, . .





: Localisation.swift , Localizable.strings Localizable.stringsdict .





?





public static let localization_var = "localization_key".localized
public static func localization_method(_ value1: String) -> String {
    "localization_method_key".localized(with: value1)
}
      
      



localized :





var localized: String {
    let localLocalisation = Self.localLocaliseBundle?.localizedString(
        forKey: self,
        value: nil,
        table: nil
    )
 
    let serverLocalisation = Self.makeServerLocaliseBundle()?.localizedString(
        forKey: self,
        value: localLocalisation,
        table: “Localizable.nocache”
    )
 
    return serverLocalisation ?? localLocalisation ?? self
}
      
      



  • ;





  • , Documents, ;





  • , , , .





, (localized(with:)), :





func localized(with parameters: CVarArg...) -> String {
    let correctLocalizedString: String = {
        if localized.starts(with: "%#@") {
            return localized
        }
 
        return localized
            .replacingOccurrences(of: "%s", with: "%@")
            .replacingOccurrences(
                of: "(%[0-9])\\$s",
                with: "$1@",
                options: .regularExpression
            )
    }()
 
    guard !correctLocalizedString.isEmpty else {
        return self
    }
 
    return String(format: correctLocalizedString, arguments: parameters)
}
      
      



:





  • plural ;





  • , Lokalise, ;





  • , ;





  • , , .





: -, Localizable.stringsdict , ; -, , , plural . , localizedString(forKey:value:table:) plural , Localizable.stringsdict, __NSLocalizedString. plural . , .regularExpression replacingOccurencies(of:with:options:) String , , __NSLocalizedString.





, : 





  1. ;





  2. Lokalise , ;





  3. , , , debug , Localisation.swift;





  4. , , , ;





  5. Lokalise;





  6. , , production Lokalise , ;





  7. production Lokalise;





  8. .





production Lokalise Gitlab , , , , , .





, .





iOS Android

, , , iOS Android -. , iOS %@, Android %s. , , Android first Lokalise, iOS .





, - . , . . , .





, , .





, 2 “” - debug production. debug , , production - , debug production.





, , production . , - . : , Localisation.swift, . , , .





, Lokalise, - . , .





, , , debug production , . , , , .





, , - , . That’s all, Folks!








All Articles