Localizing with Xcode 9

  1. Strings Management
    // Set a label's text
    label.text = "Population"
    // Set a label's text to a localized string
    label.text = NSLocalizedString("Population", comment: "Label preceding the population value")
    // Load localized string from a specific table

     label.text = NSLocalizedString("Population", tableName: nil, bundle: .main, value: "Localizable", comment: "Label preceding the population value")
     // Create a formatted string
     let format = NSLocalizedString("%d popular languages", comment:
         "Number of popular languages")
     label.text = String.localizedStringWithFormat(format, 2)
    
  2. Formatters
    let formatter = DateFormatter()
    formatter.dateStyle = .full
    let str = formatter.string(from: Date())

  3. Localization Process


    7edefd3f-3dd1-4c45-9618-8a33099e1917.png
  4. Stringsdict File

  • Handling Plurals
  • Adaptive Strings
  • Localization Export and Import
  • Other Resources
  1. Testing


    cc38490a-cd52-4810-b02c-44909eb1ddbd.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容