import Config from "../Config";
import { Lang } from "../data/const/TypeConst";
import { I18n } from "./I18nUtil";

const { ccclass, property, menu } = cc._decorator;

@ccclass
@menu("I18N/I18nSprite")
export default class I18nSprite extends cc.Component {

    @property(cc.String)
    url: string = ''

    setI18nSprite() {
        if (this.url == null) return
        if (Config.lang == Lang.lang_zh_cn) return
        I18n.LoadI18nTexture(this.node, this.url)
    }

    onLoad() {
        this.setI18nSprite()
    }
}
