Giter VIP home page Giter VIP logo

iosmultilanguagetools's Introduction

iOSMultiLanguageTools

This tool could help you do internationalization automate

如果你的项目已经迭代了不少版本了,这个时候突然有需求来说要做多语言支持。你搜索了下工程里面的汉字,然后就懵逼了,太多汉字写在代码里了!人肉搬运工?NO!

下面的这个小工具可以帮你省下不少时间。

  1. 拷贝multi-lang.py到你的工程根目录
  2. 如果你在找到这个小工具前已经做了一点国际化,那么拷贝Localizable.strings到你的工程根目录
  3. 运行python multi-lang.py, 你可能需要安装 pypinyin
  4. 将根目录下Localizable.strings拷贝回原来的路径

你代码里面需要修改的汉字都已经替换成NSLocalizedString了。

当然,如果你只想看看有哪些汉字需要被替换,修改multi-lang.py代码,设置onlyShowProcessResult = True,重新运行后,查看根目录下的out.txt吧。

这个小工具在做.strings文件的key-value对应时,只是简单的把汉字翻译成拼音来作为key,当你的汉字字符串太长或者你不喜欢拼音。那么你可以这样使用

  1. 修改multi-lang.py代码,设置onlyShowProcessResult = True,运行python multi-lang.py
  2. out.txt里修改key为你喜欢的字符串。
  3. out.txt里的内容,拷贝到Localizable.strings
  4. 修改multi-lang.py代码,设置onlyShowProcessResult = False,重新运行python multi-lang.py
  5. Done!

现在这个小工具暂时只支持OC,如果想支持其他语言,稍加改动就行了。

Know issue

  1. 暂不支持查找一行多个中文字符串

    NSArray *operators = @[@"手动档", @"自动档"];
    

    how to fix: 换成多行

    NSArray *operators = @[@"手动档", 
    						   @"自动档"];
    

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.