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