Fix some bugs in the translation tools and add better comments

parent 3cee98a9
#!/usr/bin/env bash
FILENAME="kate-editor-org"
function export_pot_file # First parameter will be the path of the pot file we have to create, includes $FILENAME
{
potfile=$1
......@@ -9,7 +11,7 @@ function export_pot_file # First parameter will be the path of the pot file we h
function import_po_files # First parameter will be a path that will contain several .po files with the format LANG.po
{
podir=$1
python3 translations.py import $podir
python3 translations.py import-po $podir
python3 translations.py generate-translations
rm -rf locale
}
......
import click
import os
import subprocess
import shutil
@click.group()
@click.pass_context
......@@ -17,7 +18,7 @@ def webpage_list():
@click.argument("pot")
def extract(pot):
"""
First parameter will be the path of the directory where we have to store the pot files
First parameter will be the path of the pot file we have to create
"""
webpages = ""
for webpage in webpage_list():
......@@ -30,17 +31,17 @@ def extract(pot):
@click.argument("directory")
def import_po(directory):
"""
First parameter will be a path that will be a directory to the dirs for each lang and then all the .po files inside
First parameter will be a path that will contain several .po files with the format LANG.po
"""
for translation in os.listdir(directory):
transdir = directory + "/" + translation
for po in os.listdir(transdir):
os.rename(directory + "/" + translation + "/" + po, "locale/" + translation + "/LC_MESSAGES/" + po)
lang = os.path.splitext(translation)[0]
os.makedirs("locale/" + lang + "/LC_MESSAGES/")
shutil.copyfile(directory + "/" + translation, "locale/" + lang + "/LC_MESSAGES/kate-editor-org.po")
@cli.command()
def generate_translations():
"""
Assume translation located at `translations/`
Assume translation located at `locale/$LANG/LC_MESSAGES/`
"""
for translations in os.listdir('locale'):
for webpage in webpage_list():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment