Code Monkey home page Code Monkey logo

creator3.0_i18n's Introduction

Creator3.0_i18n

cocos creator 3.0 TypeScript本版多语言功能

MIT

示例图

注:目前还没有做成插件形式,后期会制作完整插件完善整体功能

使用方法

使用前设置

  • 在 resources/i18n 中添加对应的语言的 json 文件

具体使用

  • 切换语言
    • 注:因为是动态加载 json 文件,所以会有延时,第一个界面面的动态修改,需要在 block 回调里面处理。静态修改的本身有处理工具本身有处理。
 LocalizedManager.changeLanguage('en');
  • 动态加载文字
//层级可以无线叠加,用 . 分割
LocalizedManager.getFinishStr('hierarchy.name', {year: 2021});
  • 静态文字(包括 Label 和 RichText )

    • 添加 LocalizedLabel.ts 脚本,设置 dataID
  • 静态图片

    • 添加 LocalizedSprite.ts 脚本,将 spriteFrameModels 数量设置为你语言数量
    • 再将 图片 和 language 对应

creator3.0_i18n's People

Contributors

chenbiaohub 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.