Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

es6模版字符串国际化处理提醒 #52

Closed
feihe08 opened this issue Mar 27, 2020 · 1 comment
Closed

es6模版字符串国际化处理提醒 #52

feihe08 opened this issue Mar 27, 2020 · 1 comment

Comments

@feihe08
Copy link

feihe08 commented Mar 27, 2020

比如const text = `你有${nums}条消息`在nums为1和不为1的时候翻译是不一致的,这种情况下翻译可能会不准确,希望针对这种情况增加提示,比如替换完成后生成一个kiwi-notice.txt文件,里面是收集到的是带变量模版字符串的位置,提示用户注意这里。

@linhuiw
Copy link
Member

linhuiw commented Jul 4, 2022

var MESSAGES = {
    'en-US': {
        NUM_PHOTOS: 'You have {numPhotos, plural, ' +
            '=0 {no photos.}' +
            '=1 {one photo.}' +
            'other {# photos.}}'
    },

    'es-MX': {
        NUM_PHOTOS: 'Usted {numPhotos, plural, ' +
            '=0 {no tiene fotos.}' +
            '=1 {tiene una foto.}' +
            'other {tiene # fotos.}}'
    }
};

这里模板里面是支持这种条件的逻辑的。
直接在代码里面使用即可。

@linhuiw linhuiw closed this as completed Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants