Giter VIP home page Giter VIP logo

multilingual's Introduction

Multilingual

代码来源于Maxim Bilan地址,该代的主要功能是实现应用内切换语言(不需要重启应用)。脚本来源于mokai地址,该脚本的功能是实现编译的时对storyboard或xib对应的.strings文件中增量添加key,value,在mokai的脚本上增加处理工程中所有的storyboard和xib,mokai还有一篇国际化的文章

使用方法

1.podfile 引入Multilingual

pod 'Multilingual', :git => 'https://github.com/JustinYangJing/Multilingual.git'

2.为项目的target添加编译时运行的脚本AutoGenStrings.py

python ${SRCROOT}/Pods/Multilingual/Multilingual/AutoGenStrings.py ${SRCROOT}/${TARGET_NAME}

3.在Appdelegate中引入LanguageManager.h并使用[LanguageManager setupCurrentLanguage];初始化

4.在项目中使用NSLocalizedStringNSLocalizedStringFromTable来索引key所对应的当前语言的值,如果使用中文作为key,那中文对应的*.strings文件可不实现。

5.在切换语言的VC中使用+ (void)saveLanguageByIndex:(NSInteger)index; 或者+ (void)saveLanguageByCode:(NSString *)language切换语言,并重设Appdelegate.window.rootViewController

multilingual's People

Contributors

justinyangjing avatar wang68543 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.