Admin interface allows overwriting any stranslations which is very healful not just for utilizing community translation while updating them with custom phrases that suit a specific community, but at the same time it is also a very good way to gradually translate a new language, without the need of updating the code, hence rebuilding the cache. However, it would be great if the customized translations can be exported from the database and somehoe merged back into the corresponding YAML files to make it available in the main repository. Is there a way of doing that which I am not aware of?
I don’t think there is a job for this but 100% support these two tasks, which could help you out here
rake export:locale_overrides:server > server.xx.yml
rake export:locale_overrides:client > client.xx.yml
有人知道是否有人已经制作了这个吗?
@sam 我已运行导出本地化的任务,但它不起作用。
我收到了以下消息:
Don't know how to build task 'export:locale_overrides:server' (See the list of available tasks with `rake --tasks`)
有什么想法吗?
还没有人认领此任务,将添加 pr-welcome 以示清晰。
我也一直在考虑这个问题,并创建了一个 PR:
为了完成这个闭环,我和 @mqmenchaca 在不知道对方在做的情况下同时进行了这项工作。而且我们的 PR 只相隔了几个小时!在看到 Max 的 PR 之前,我已经将我的 PR 合并到了 core 中,所以很遗憾我们无法将他的工作合并到 core 中。尽管如此,我还是非常感谢你的贡献,@mqmenchaca!
添加此功能的提交是这个:DEV: Add a rake task to export/import translation overrides (#18487) · discourse/discourse@4d80110 · GitHub
要导出,请运行 bin/rake export:translation_overrides(它将创建一个包含覆盖项的 JSON 文件)。
要在单独的实例中导入,请将导出的 JSON 文件复制到那里并运行 bin/rake import:file[\"filename\"]。
你好。请问你能描述一下运行它的步骤吗?
./launcher enter app
bin/rake export:translation_overrides
返回:
rake aborted!
ActiveRecord::NoDatabaseError: 我们找不到您的数据库:discourse。该数据库可以在位于 config/database.yml 的数据库配置文件中找到
这似乎是您环境中的一个问题。当我在我自己的自托管实例中进入容器时,我可以很好地运行 rake 命令。
我正在使用 Nginx 后端的 Discourse,这可能有关联吗?是否可以使用容器外面的数据库来运行该命令?
“好的,我做了一些测试,并且已经导出了文件。”
如果我修改该文件,将“es_XX”更改为“es”(并且不更改其他任何内容,同时注意文件的格式和字符编码),然后导入之前导出的文件,它应该可以工作吗?
我想将之前的覆盖项移动到我们实例上的默认“es”语言 ![]()