Shell icon indicating copy to clipboard operation
Shell copied to clipboard

Simple config i18n

Open cAttte opened this issue 2 years ago • 0 comments

the changes in #382 were applied to all four languages, which leads me to a minor suggestion: config file localization. it obviously doesn't have to be part of the actual program, just a part of the build system. this would let something like this

# config/en/imports/file-manage.nss
item(title='Hidden' checked=io.attribute.hidden(atrr)
# config/ko/imports/file-manage.nss
item(title='숨김' checked=io.attribute.hidden(atrr)

be simplified into something like this:

# config/imports/file-manage.nss
item(title='{{fileManage.attributes.hidden}}' checked=io.attribute.hidden(atrr)
// config/imports/strings.en.json
"fileManage.attributes.hidden": "Hidden"
// config/imports/strings.en.json
"fileManage.attributes.hidden": "숨김"

such simple functionality can be achieved with a simple script that looks something like (pseudo-code):

for (file in files)
    for (lang in langs)
        fs.write(lang.code + '/' + file.name,
            file.content.replace(/\{\{(.+?)\}\}/, (_, id) => lang.strings[id])

at first glance this might seem more complicated, but it would enable translators to focus on translating only, which is especially going to come in handy whenever new languages get added!

cAttte avatar Dec 19 '23 00:12 cAttte