[SOLVED] Custom language in admin panel
-
The javascript programmers (rofl) think people doesn't deserve a reply. Open $ource. (really hard to find github link in nodebb.org)
-
This is an active forum. Posts can get buried. It also takes time to reply to everyone.
And yes the Github link should be clearly on the site but Google is your friend.
I'm not very acquainted with Transifex, and I don't know if it's possible to test the translations out ahead of time. But if it is possible to download the translations, then you can copy them into the correct directory in
/public/src/language
and then start NodeBB with the new translations.Thanks for your translations.
-
@priapo said in Custom language in admin panel:
The javascript programmers (rofl) think people doesn't deserve a reply. Open $ource. (really hard to find github link in nodebb.org)
Kind of a jerk post. You do realize you posted your original question right before a holiday weekend right?
-
Well, I have no time for discuting bs with js;
The admin language files are inside [nodebb]/public/language/YOURFORUMLANGUAGE/admin/
I have made a python3 script to make an organized
admin/
directory from the files downloaded from transifex. (You should download all files one by one, should be 30 or 40, takes 7~10 minutes)- Make a new directory
- Dowload all translated .json files to that directory
- They have names like
for_use_nodebb_admin-advanced-events_pt_BR.json
. - Save this script in a file called
freak.python3
in the directory you created.
#!/usr/bin/env python3 import os import glob # use os.system("") to do it lil boy import subprocess # Files downloaded from transifex has this string in filename. # This should be removed from them; change with yours. language_str = "_pt_BR" json_files = glob.glob('*.json', recursive=False) dirs_created = list() for file in json_files: ripped = file.split('-', 2) # 2 here is a hack to avoid splitting ip-blacklist.json and web-crawler.json json_filename = ripped[-1].replace(language_str,'') print(ripped) if len(ripped) == 3: directory = "admin/{0}/".format(ripped[1]) elif len(ripped) == 2: directory = "admin/" else: directory = "ERROR/" # if this directory appears something went wrong if not directory in dirs_created: dirs_created.append(directory) print(directory) os.system("mkdir -p {0}".format(directory)) print(json_filename) os.system("cp {0} {1}{2}".format(file, directory, json_filename))
- CHANGE THE LINE
language_str = "_pt_BR"
WITH YOUR LANGUAGE KEEPING THE _ before.. - Make it executable:
chmod +x freak.python3
- Execute it:
./freak.python3
- This will create an
admin/
directory inside the directory, tar it and send to server:tar zcvf admin.tgz admin/
scp admin.tgz SSHUSER@SSHSERVER:
or whetever you use.
-
@priapo hey that's pretty neat. Thanks for sharing.
-
Transifex has CLI client - so you don't need to manually download all translation files.
https://docs.transifex.com/client/introduction