i18nLabel.ts 308 B

12345678910111213141516
  1. import i18n from "./i18n";
  2. const {ccclass, property} = cc._decorator;
  3. @ccclass
  4. export default class i18nLabel extends cc.Component {
  5. onLoad () {
  6. let label = this.node.getComponent(cc.Label)
  7. if(label){
  8. label.string = i18n.t(label.string)
  9. }
  10. }
  11. }