GithubHelp home page GithubHelp logo

localization's Introduction

iOS项目国际化改造

使用方式

1、传入路径,此处projectPath为绝对路径

python3 AutoLocalizable.py [projectPath]

2、直接将文件放到project工程目录下

python3 AutoLocalizable.py

3、将文件配置到xcode的run script上,每次编译直接执行

image-20230227210609308

xib,sb文件处理

xib,sb文件在第一次开启Localization时会自动生成对应的strings文件并将用到的文本添加到strings中,但是后续添加控件时不会自动添加文本。后续可以使用ibtool命令来生成strings文件

ibtool [filePath] --generate-strings-file [resultPath]

新生成的strings文件与原strings文件合并

  1. 在原文件中删除掉的控件ID信息前面加//注释掉
  2. 新文件中添加的空间信息写入原strings文件中

纯代码文件处理

纯代码文件可以使用genstrings命令来生成strings文件

find . -name \*.m | xargs genstrings -o [resultPath]

新生成的strings文件与原strings文件合并,原理与上面相同

localization's People

Contributors

luckyxyj avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 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.