How to move/restore custom translation to new discourse instance

I have looking around and i found only 1 way to backup locales folder and restore it in the new discourse; but im looking for advanced advice from expert member here.

How to restore site setting + customize languages ( which has been changed by me word by word ).

and restore it to new discourse, how to achive that ? by coping locales.tar.gz to new discourse forum ?

I have exported the translation by this command:

root@old-app:/# rake export:translation_overrides
Exporting all translation overridesā€¦

Export saved to translation-overrides-2023-04-02-223254.json

Done

root@old-app:/#

and then move the file translation-overrides-2023-04-02-223254.json to new discourse container and restore using this command:

root@ar:/var/discourse# docker exec -it app rails r ā€˜SiteSetting.import_settings_from_file(ā€œtranslation-overrides-2023-04-02-223254.jsonā€)ā€™
Please specify a valid ruby command or the path of a script to run.
Run ā€˜rails runner -hā€™ for help.

undefined method `import_settings_from_fileā€™ for SiteSetting:Class
root@ar:/var/discourse#

and try this

root@app:/var/www/discourse# rake import:translation_overrides[ā€˜translation-overrides-2023-04-02-223254.jsonā€™]
rake aborted!
Donā€™t know how to build task ā€˜import:translation_overridesā€™ (See the list of available tasks with rake --tasks)
Did you mean? export:translation_overrides
/usr/local/bin/bundle:25:in load' /usr/local/bin/bundle:25:in ā€™
(See full trace by running task with --trace)
root@app:/var/www/discourse#

I check the last rake tasks using command:

bundle exec rake -T

ā€“ rask tasks
https://pastebin.mozilla.org/gLvK4Yq4/raw

Based on the output you provided, it seems that the rake import:translation_overrides task is not defined in Discourse installation, which is causing the error; how i may import it ?

ā€“ I found out; here is it for future guys who need this assistance.

root@app:/var/www/discourse# rake import:file[translation-overrides-2023-04-02-223848.json]
Importing translation overrides...

Done

root@app:/var/www/discourse#
2 Likes