From 9977de9fa9f62711baa6350413a53bed07569492 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jun 14 2021 18:41:59 +0000 Subject: [PATCH 1/3] build en site independently of LINGUAS content --- diff --git a/Makefile.in b/Makefile.in index f7fc5d8..94239c9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -27,7 +27,7 @@ sync = \ fi \ fi -all:: $(LANGUAGES) +all:: en $(LANGUAGES) cp static/robots.txt out/ static: @@ -44,6 +44,9 @@ else for me to get its name.. Please use a wise name." endif +po/en.po: pot + msginit -i $(POT_FILE) --no-translator -l en -o po/en.po + data/templates/translations.html: po/LINGUAS $(PYTHON) $(BUILDDIR)/construct-translations.py $(BUILDDIR)/translations.ini $^ $@ @@ -59,7 +62,7 @@ pushpot: pot rm -rf $(TRANS_TMP) pullpos: - git clone ssh://git@pagure.io/fedora-web/translations.git $(TRANS_TMP) + git clone https://pagure.io/fedora-web/translations.git $(TRANS_TMP) cp -R $(TRANS_TMP)/$(TRANS_FOLDER)/*.po ./po/ cp -R $(TRANS_TMP)/$(TRANS_FOLDER)/LINGUAS ./po/ rm -rf $(TRANS_TMP) diff --git a/alt.fedoraproject.org/Makefile b/alt.fedoraproject.org/Makefile index 5641b94..ab51707 100644 --- a/alt.fedoraproject.org/Makefile +++ b/alt.fedoraproject.org/Makefile @@ -1,5 +1,5 @@ include ../Makefile.in -$(LANGUAGES): % : | static po/%.mo data/templates/translations.html +en $(LANGUAGES): % : | static po/%.mo data/templates/translations.html $(PYTHON) $(BUILDDIR)/build.py -o out -i data/content -l $@ -p po -b $(BASEPATH) diff --git a/arm.fedoraproject.org/Makefile b/arm.fedoraproject.org/Makefile index c3ffe4c..8c374bf 100644 --- a/arm.fedoraproject.org/Makefile +++ b/arm.fedoraproject.org/Makefile @@ -1,5 +1,5 @@ include ../Makefile.in -$(LANGUAGES): % : | static rss-cache po/%.mo data/templates/translations.html +en $(LANGUAGES): % : | static rss-cache po/%.mo data/templates/translations.html $(PYTHON) $(BUILDDIR)/build.py -o out -i data/content -l $@ -p po -b $(BASEPATH) diff --git a/build.d/buildconf.py b/build.d/buildconf.py index d1e8b81..a8297f7 100755 --- a/build.d/buildconf.py +++ b/build.d/buildconf.py @@ -1,7 +1,7 @@ #!/usr/bin/python import sys -languages = [] +languages = [("en", "en"),] linguasfile = sys.argv[1] linguas = open(linguasfile) diff --git a/fedoracommunity.org/Makefile b/fedoracommunity.org/Makefile index 5641b94..ab51707 100644 --- a/fedoracommunity.org/Makefile +++ b/fedoracommunity.org/Makefile @@ -1,5 +1,5 @@ include ../Makefile.in -$(LANGUAGES): % : | static po/%.mo data/templates/translations.html +en $(LANGUAGES): % : | static po/%.mo data/templates/translations.html $(PYTHON) $(BUILDDIR)/build.py -o out -i data/content -l $@ -p po -b $(BASEPATH) diff --git a/labs.fedoraproject.org/Makefile b/labs.fedoraproject.org/Makefile index c3ffe4c..8c374bf 100644 --- a/labs.fedoraproject.org/Makefile +++ b/labs.fedoraproject.org/Makefile @@ -1,5 +1,5 @@ include ../Makefile.in -$(LANGUAGES): % : | static rss-cache po/%.mo data/templates/translations.html +en $(LANGUAGES): % : | static rss-cache po/%.mo data/templates/translations.html $(PYTHON) $(BUILDDIR)/build.py -o out -i data/content -l $@ -p po -b $(BASEPATH) diff --git a/spins.fedoraproject.org/Makefile b/spins.fedoraproject.org/Makefile index 5641b94..ab51707 100644 --- a/spins.fedoraproject.org/Makefile +++ b/spins.fedoraproject.org/Makefile @@ -1,5 +1,5 @@ include ../Makefile.in -$(LANGUAGES): % : | static po/%.mo data/templates/translations.html +en $(LANGUAGES): % : | static po/%.mo data/templates/translations.html $(PYTHON) $(BUILDDIR)/build.py -o out -i data/content -l $@ -p po -b $(BASEPATH) diff --git a/start.fedoraproject.org/Makefile b/start.fedoraproject.org/Makefile index 6ad7d85..7c976ee 100644 --- a/start.fedoraproject.org/Makefile +++ b/start.fedoraproject.org/Makefile @@ -1,8 +1,9 @@ include ../Makefile.in -$(LANGUAGES): % : | static rss-cache po/%.mo data/templates/translations.html +en $(LANGUAGES): % : | static rss-cache po/%.mo data/templates/translations.html $(PYTHON) $(BUILDDIR)/build.py -o out -i data/content -l $@ -p po -b $(BASEPATH) rss-cache: @echo Caching Magazine Feed... - $(PYTHON) $(PWD)/build/magfeed.py -o out -s static -b $(BASEPATH) \ No newline at end of file + $(PYTHON) $(PWD)/build/magfeed.py -o out -s static -b $(BASEPATH) + From ae9e4d8afcf48e3411a71461a7170d27add1cbe0 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jun 14 2021 18:41:59 +0000 Subject: [PATCH 2/3] ignore pullpos for non-translated/retired site --- diff --git a/boot.fedoraproject.org/Makefile b/boot.fedoraproject.org/Makefile index 5641b94..5ebd707 100644 --- a/boot.fedoraproject.org/Makefile +++ b/boot.fedoraproject.org/Makefile @@ -1,5 +1,8 @@ include ../Makefile.in +# retired +pullpos: ; + $(LANGUAGES): % : | static po/%.mo data/templates/translations.html $(PYTHON) $(BUILDDIR)/build.py -o out -i data/content -l $@ -p po -b $(BASEPATH) diff --git a/budget.fedoraproject.org/Makefile b/budget.fedoraproject.org/Makefile index c3ffe4c..8dc731d 100644 --- a/budget.fedoraproject.org/Makefile +++ b/budget.fedoraproject.org/Makefile @@ -1,5 +1,8 @@ include ../Makefile.in +# no translation +pullpos: ; + $(LANGUAGES): % : | static rss-cache po/%.mo data/templates/translations.html $(PYTHON) $(BUILDDIR)/build.py -o out -i data/content -l $@ -p po -b $(BASEPATH) diff --git a/fedoraproject.org/Makefile b/fedoraproject.org/Makefile index c3ffe4c..ffcac3e 100644 --- a/fedoraproject.org/Makefile +++ b/fedoraproject.org/Makefile @@ -1,5 +1,8 @@ include ../Makefile.in +# retired? +pullpos: ; + $(LANGUAGES): % : | static rss-cache po/%.mo data/templates/translations.html $(PYTHON) $(BUILDDIR)/build.py -o out -i data/content -l $@ -p po -b $(BASEPATH) diff --git a/flocktofedora.org/Makefile b/flocktofedora.org/Makefile index c3ffe4c..53a2790 100644 --- a/flocktofedora.org/Makefile +++ b/flocktofedora.org/Makefile @@ -1,5 +1,8 @@ include ../Makefile.in +# Not translated, yet +pullpos: ; + $(LANGUAGES): % : | static rss-cache po/%.mo data/templates/translations.html $(PYTHON) $(BUILDDIR)/build.py -o out -i data/content -l $@ -p po -b $(BASEPATH) diff --git a/getfedora.org/Makefile b/getfedora.org/Makefile index e985692..bf621ad 100644 --- a/getfedora.org/Makefile +++ b/getfedora.org/Makefile @@ -1,5 +1,8 @@ include ../Makefile.in +# moved (see fedora-web/websites) +pullpos: ; + $(LANGUAGES): % : | static rss-cache po/%.mo data/templates/translations.html $(PYTHON) $(BUILDDIR)/build.py -o out -i data/content -l $@ -p po -b $(BASEPATH) From 61ddcd4f1e1dcd3cc374799cbc3d45cc30d1def0 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jun 14 2021 18:42:00 +0000 Subject: [PATCH 3/3] use langtable library to dynamically build the language menu --- diff --git a/build.d/construct-translations.py b/build.d/construct-translations.py index dd3cefa..3917489 100755 --- a/build.d/construct-translations.py +++ b/build.d/construct-translations.py @@ -1,6 +1,7 @@ #!/bin/env python import ConfigParser, sys, os +import langtable ''' This script takes the contents of the website-specific LINGUAS file, constructs an options menu for the languages contained therein. @@ -40,7 +41,8 @@ with open(sys.argv[2], 'r') as linguas: # Linguas is where available languages a lang = lang.strip() if lang and not lang.startswith('#') and not lang in banned: #output.write(' \n') - output.write(", '"+lang+"': '"+language_map.get('Languages',lang)+"'") + #output.write(", '"+lang+"': '"+language_map.get('Languages',lang)+"'") + output.write(", '"+lang+"': '"+langtable.language_name(languageId=lang).encode('utf-8')+"'") finally: linguas.close() output.write("""}