Commit 5e5206db authored by Carl Schwan's avatar Carl Schwan 🚴
Browse files

Add nl and fix sv homepage

parent 2ac94ed6
......@@ -55,6 +55,23 @@ languages:
- name: Donner
url: /fr/community/donations
weight: 4
nl:
contentDir: content-trans/nl
languageName: Nederlands
menu:
main:
- name: Producten
url: /nl/products/
weight: 1
- name: Ontwerpen
url: https://develop.kde.org
weight: 2
- name: Get Involved
url: https://community.kde.org/Get_Involved
weight: 3
- name: Doneren
url: /nl/community/donations
weight: 4
pt:
contentDir: content-trans/pt
languageName: Português
......
......@@ -41,7 +41,7 @@ re_has_qt_contexts = re.compile('X-Qt-Contexts: true\\n')
if not os.path.exists(OUTPUT_PO_PATH):
os.mkdir(OUTPUT_PO_PATH)
all_languages = "af ar bs ca ca@valencia crh cs csb cy da de el en en_GB eo es et eu fa fi fr fy ga gd gl hu hy id is it ja ka kk km kn ko lb lt lv mai mk ml mr ms mt nb ne nl nn nso oc or pa pl ps pt pt_BR ro ru rw se si sk sl sq sr sr@ijekavian sr@ijekavianlatin sr@latin sv tr uk xh zh_CN zh_HK zh_TW"
all_languages = "ar bs ca ca@valencia cs de el es et eu fa fi fr gl hu it ja ko lt nl pl pt pt_BR ru sk sv tr uk zh_CN zh_TW"
all_languages = [x.strip() for x in all_languages.split(" ") if len(x)]
for lang in all_languages:
......
......@@ -386,13 +386,15 @@ def generate_translations(args):
Assume translation located at `locale/$LANG/LC_MESSAGES/`
"""
for translations in os.listdir('locale'):
print(translations)
os.environ["LANGUAGE"] = translations
translated_page = 0
total_page = 0
for category, webpages in webpage_list().items():
gettext.bindtextdomain(category, os.path.abspath('locale'))
gettext.textdomain(category)
_ = gettext.gettext
for webpage in webpages:
total_page += 1
translated = re.sub('content/', 'content/' + translations + '/', webpage)
translated = re.sub('content/', 'content-trans/' + translations + '/', webpage)
os.makedirs(os.path.dirname(translated), exist_ok=True)
......@@ -402,7 +404,7 @@ def generate_translations(args):
content, percent = import_content(post, _)
if percent > 0.5 or has_translations:
print(translated)
translated_page += 1
with open(translated, 'w+') as translation_file:
translation_file.write('---\n')
translation_file.write(dump(post.metadata, default_flow_style=False, allow_unicode=True))
......@@ -413,6 +415,7 @@ def generate_translations(args):
with open(translated, 'w') as f_output:
f_output.write(data)
print("{} [{}/{}]".format(translations, translated_page, total_page))
with open("i18n/en.yaml", 'r') as stream:
en_string_trans = safe_load(stream)
......
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