mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2025-05-15 22:42:54 +00:00
Add all locales
This commit is contained in:
parent
c33300bf77
commit
dd4fe8cba4
61 changed files with 16385 additions and 208 deletions
|
@ -4,13 +4,25 @@ import os
|
|||
from babel.messages.frontend import main as pybabel
|
||||
|
||||
if __name__ == "__main__":
|
||||
locales_dir = os.path.join("libretranslate", "locales")
|
||||
if not os.path.isdir(locales_dir):
|
||||
os.makedirs(locales_dir)
|
||||
if len(sys.argv) >= 2 and sys.argv[1] == 'mdtable':
|
||||
from libretranslate.locales import get_available_locales
|
||||
locales = get_available_locales(only_reviewed=False, sort_by_name=True)
|
||||
print("Language | Reviewed | Weblate Link")
|
||||
print("-------- | -------- | ------------")
|
||||
|
||||
print("Compiling locales")
|
||||
sys.argv = ["", "compile", "-f", "-d", locales_dir]
|
||||
pybabel()
|
||||
for l in locales:
|
||||
link = "https://hosted.weblate.org/translate/libretranslate/app/%s/" % l['code']
|
||||
if l['code'] == 'en':
|
||||
link = "https://hosted.weblate.org/projects/libretranslate/app/"
|
||||
print("%s | %s | %s" % (l['name'], ':heavy_check_mark:' if l['reviewed'] else '', "[Edit](%s)" % link))
|
||||
else:
|
||||
locales_dir = os.path.join("libretranslate", "locales")
|
||||
if not os.path.isdir(locales_dir):
|
||||
os.makedirs(locales_dir)
|
||||
|
||||
print("Compiling locales")
|
||||
sys.argv = ["", "compile", "-f", "-d", locales_dir]
|
||||
pybabel()
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue