From 1a025ae7ba0e5d727093eaa08c6c1fc8c9370620 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Sat, 16 Jan 2021 18:08:19 +0000 Subject: [PATCH] Reorganize the translations to work with msgfmt executable The -d option for the msgfmt executable requires that all the locales have their po files in the same directory and be named LOCALE.po. --- CMakeModules/Functions.cmake | 2 +- translation/CMakeLists.txt | 2 +- translation/{ => pofiles}/LINGUAS | 0 translation/{bg/kicad.po => pofiles/bg.po} | 0 translation/{ca/kicad.po => pofiles/ca.po} | 0 translation/{cs/kicad.po => pofiles/cs.po} | 0 translation/{da/kicad.po => pofiles/da.po} | 0 translation/{de/kicad.po => pofiles/de.po} | 0 translation/{el/kicad.po => pofiles/el.po} | 0 translation/{en/kicad.po => pofiles/en.po} | 0 translation/{es/kicad.po => pofiles/es.po} | 0 translation/{fi/kicad.po => pofiles/fi.po} | 0 translation/{fr/kicad.po => pofiles/fr.po} | 0 translation/{hu/kicad.po => pofiles/hu.po} | 0 translation/{id/kicad.po => pofiles/id.po} | 0 translation/{it/kicad.po => pofiles/it.po} | 0 translation/{ja/kicad.po => pofiles/ja.po} | 0 translation/{ko/kicad.po => pofiles/ko.po} | 0 translation/{lt/kicad.po => pofiles/lt.po} | 0 translation/{lv/kicad.po => pofiles/lv.po} | 0 translation/{nl/kicad.po => pofiles/nl.po} | 0 translation/{no/kicad.po => pofiles/no.po} | 0 translation/{pl/kicad.po => pofiles/pl.po} | 0 translation/{pt/kicad.po => pofiles/pt.po} | 0 translation/{ru/kicad.po => pofiles/ru.po} | 0 translation/{sk/kicad.po => pofiles/sk.po} | 0 translation/{sl/kicad.po => pofiles/sl.po} | 0 translation/{sv/kicad.po => pofiles/sv.po} | 0 translation/{tr/kicad.po => pofiles/tr.po} | 0 translation/{vi/kicad.po => pofiles/vi.po} | 0 translation/{zh_CN/kicad.po => pofiles/zh_CN.po} | 0 translation/{zh_TW/kicad.po => pofiles/zh_TW.po} | 0 translation/update-po-files.sh | 12 ++++++------ 33 files changed, 8 insertions(+), 8 deletions(-) rename translation/{ => pofiles}/LINGUAS (100%) rename translation/{bg/kicad.po => pofiles/bg.po} (100%) rename translation/{ca/kicad.po => pofiles/ca.po} (100%) rename translation/{cs/kicad.po => pofiles/cs.po} (100%) rename translation/{da/kicad.po => pofiles/da.po} (100%) rename translation/{de/kicad.po => pofiles/de.po} (100%) rename translation/{el/kicad.po => pofiles/el.po} (100%) rename translation/{en/kicad.po => pofiles/en.po} (100%) rename translation/{es/kicad.po => pofiles/es.po} (100%) rename translation/{fi/kicad.po => pofiles/fi.po} (100%) rename translation/{fr/kicad.po => pofiles/fr.po} (100%) rename translation/{hu/kicad.po => pofiles/hu.po} (100%) rename translation/{id/kicad.po => pofiles/id.po} (100%) rename translation/{it/kicad.po => pofiles/it.po} (100%) rename translation/{ja/kicad.po => pofiles/ja.po} (100%) rename translation/{ko/kicad.po => pofiles/ko.po} (100%) rename translation/{lt/kicad.po => pofiles/lt.po} (100%) rename translation/{lv/kicad.po => pofiles/lv.po} (100%) rename translation/{nl/kicad.po => pofiles/nl.po} (100%) rename translation/{no/kicad.po => pofiles/no.po} (100%) rename translation/{pl/kicad.po => pofiles/pl.po} (100%) rename translation/{pt/kicad.po => pofiles/pt.po} (100%) rename translation/{ru/kicad.po => pofiles/ru.po} (100%) rename translation/{sk/kicad.po => pofiles/sk.po} (100%) rename translation/{sl/kicad.po => pofiles/sl.po} (100%) rename translation/{sv/kicad.po => pofiles/sv.po} (100%) rename translation/{tr/kicad.po => pofiles/tr.po} (100%) rename translation/{vi/kicad.po => pofiles/vi.po} (100%) rename translation/{zh_CN/kicad.po => pofiles/zh_CN.po} (100%) rename translation/{zh_TW/kicad.po => pofiles/zh_TW.po} (100%) diff --git a/CMakeModules/Functions.cmake b/CMakeModules/Functions.cmake index 446fd4e695..1c6209815f 100644 --- a/CMakeModules/Functions.cmake +++ b/CMakeModules/Functions.cmake @@ -134,7 +134,7 @@ function( translate_language LANG OUT_FILE) add_custom_command( OUTPUT ${OUT_FILE} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} - ${CMAKE_CURRENT_SOURCE_DIR}/${LANG}/kicad.po + ${CMAKE_CURRENT_SOURCE_DIR}/pofiles/${LANG}.po -o ${OUT_FILE} COMMENT "Building translation library for ${LANG}" ) diff --git a/translation/CMakeLists.txt b/translation/CMakeLists.txt index ec24a188c4..946f0c6b24 100644 --- a/translation/CMakeLists.txt +++ b/translation/CMakeLists.txt @@ -7,7 +7,7 @@ else() CACHE PATH "Location of KiCad i18n files." ) endif() -file(STRINGS LINGUAS LANG_ARRAY REGEX "^[^#].*") +file(STRINGS pofiles/LINGUAS LANG_ARRAY REGEX "^[^#].*") # Add the commands to translate each language file foreach( LANG ${LANG_ARRAY} ) diff --git a/translation/LINGUAS b/translation/pofiles/LINGUAS similarity index 100% rename from translation/LINGUAS rename to translation/pofiles/LINGUAS diff --git a/translation/bg/kicad.po b/translation/pofiles/bg.po similarity index 100% rename from translation/bg/kicad.po rename to translation/pofiles/bg.po diff --git a/translation/ca/kicad.po b/translation/pofiles/ca.po similarity index 100% rename from translation/ca/kicad.po rename to translation/pofiles/ca.po diff --git a/translation/cs/kicad.po b/translation/pofiles/cs.po similarity index 100% rename from translation/cs/kicad.po rename to translation/pofiles/cs.po diff --git a/translation/da/kicad.po b/translation/pofiles/da.po similarity index 100% rename from translation/da/kicad.po rename to translation/pofiles/da.po diff --git a/translation/de/kicad.po b/translation/pofiles/de.po similarity index 100% rename from translation/de/kicad.po rename to translation/pofiles/de.po diff --git a/translation/el/kicad.po b/translation/pofiles/el.po similarity index 100% rename from translation/el/kicad.po rename to translation/pofiles/el.po diff --git a/translation/en/kicad.po b/translation/pofiles/en.po similarity index 100% rename from translation/en/kicad.po rename to translation/pofiles/en.po diff --git a/translation/es/kicad.po b/translation/pofiles/es.po similarity index 100% rename from translation/es/kicad.po rename to translation/pofiles/es.po diff --git a/translation/fi/kicad.po b/translation/pofiles/fi.po similarity index 100% rename from translation/fi/kicad.po rename to translation/pofiles/fi.po diff --git a/translation/fr/kicad.po b/translation/pofiles/fr.po similarity index 100% rename from translation/fr/kicad.po rename to translation/pofiles/fr.po diff --git a/translation/hu/kicad.po b/translation/pofiles/hu.po similarity index 100% rename from translation/hu/kicad.po rename to translation/pofiles/hu.po diff --git a/translation/id/kicad.po b/translation/pofiles/id.po similarity index 100% rename from translation/id/kicad.po rename to translation/pofiles/id.po diff --git a/translation/it/kicad.po b/translation/pofiles/it.po similarity index 100% rename from translation/it/kicad.po rename to translation/pofiles/it.po diff --git a/translation/ja/kicad.po b/translation/pofiles/ja.po similarity index 100% rename from translation/ja/kicad.po rename to translation/pofiles/ja.po diff --git a/translation/ko/kicad.po b/translation/pofiles/ko.po similarity index 100% rename from translation/ko/kicad.po rename to translation/pofiles/ko.po diff --git a/translation/lt/kicad.po b/translation/pofiles/lt.po similarity index 100% rename from translation/lt/kicad.po rename to translation/pofiles/lt.po diff --git a/translation/lv/kicad.po b/translation/pofiles/lv.po similarity index 100% rename from translation/lv/kicad.po rename to translation/pofiles/lv.po diff --git a/translation/nl/kicad.po b/translation/pofiles/nl.po similarity index 100% rename from translation/nl/kicad.po rename to translation/pofiles/nl.po diff --git a/translation/no/kicad.po b/translation/pofiles/no.po similarity index 100% rename from translation/no/kicad.po rename to translation/pofiles/no.po diff --git a/translation/pl/kicad.po b/translation/pofiles/pl.po similarity index 100% rename from translation/pl/kicad.po rename to translation/pofiles/pl.po diff --git a/translation/pt/kicad.po b/translation/pofiles/pt.po similarity index 100% rename from translation/pt/kicad.po rename to translation/pofiles/pt.po diff --git a/translation/ru/kicad.po b/translation/pofiles/ru.po similarity index 100% rename from translation/ru/kicad.po rename to translation/pofiles/ru.po diff --git a/translation/sk/kicad.po b/translation/pofiles/sk.po similarity index 100% rename from translation/sk/kicad.po rename to translation/pofiles/sk.po diff --git a/translation/sl/kicad.po b/translation/pofiles/sl.po similarity index 100% rename from translation/sl/kicad.po rename to translation/pofiles/sl.po diff --git a/translation/sv/kicad.po b/translation/pofiles/sv.po similarity index 100% rename from translation/sv/kicad.po rename to translation/pofiles/sv.po diff --git a/translation/tr/kicad.po b/translation/pofiles/tr.po similarity index 100% rename from translation/tr/kicad.po rename to translation/pofiles/tr.po diff --git a/translation/vi/kicad.po b/translation/pofiles/vi.po similarity index 100% rename from translation/vi/kicad.po rename to translation/pofiles/vi.po diff --git a/translation/zh_CN/kicad.po b/translation/pofiles/zh_CN.po similarity index 100% rename from translation/zh_CN/kicad.po rename to translation/pofiles/zh_CN.po diff --git a/translation/zh_TW/kicad.po b/translation/pofiles/zh_TW.po similarity index 100% rename from translation/zh_TW/kicad.po rename to translation/pofiles/zh_TW.po diff --git a/translation/update-po-files.sh b/translation/update-po-files.sh index 29e84d4472..23f5581925 100755 --- a/translation/update-po-files.sh +++ b/translation/update-po-files.sh @@ -65,7 +65,7 @@ find $POTDIRS -name '*.cpp' -or -name '*.h' | sort | xgettext -f- -k_ -k_HKI -kwxPLURAL:1,2 --force-po --from-code utf-8 -o $LOCALDIR/kicad.pot -LINGUAS=`cat $LOCALDIR/LINGUAS|grep -v '^#'|grep -v '^\s*$'` #Read file without comment and empty lines +LINGUAS=`cat $LOCALDIR/pofiles/LINGUAS|grep -v '^#'|grep -v '^\s*$'` #Read file without comment and empty lines #check if present in locale list validate() { echo $LINGUAS | grep -F -q -w "$1"; } @@ -94,11 +94,11 @@ do echo "## $i" if [ "$i" = "en" ] ; then msgmerge --no-location --no-fuzzy-matching --force-po $LOCALDIR/$i/kicad.po $LOCALDIR/kicad.pot -o $LOCALDIR/$i/kicad.po 2> /dev/null - msgen $LOCALDIR/$i/kicad.po -o $LOCALDIR/$i/kicad.po.tmp && mv $LOCALDIR/$i/kicad.po.tmp $LOCALDIR/$i/kicad.po + msgen $LOCALDIR/pofiles/$i.po -o $LOCALDIR/pofiles/$i.po.tmp && mv $LOCALDIR/pofiles/$i.po.tmp $LOCALDIR/pofiles/$i.po else - msgmerge --force-po $LOCALDIR/$i/kicad.po $LOCALDIR/kicad.pot -o $LOCALDIR/$i/kicad.po 2> /dev/null + msgmerge --force-po $LOCALDIR/pofiles/$i.po $LOCALDIR/pofiles/kicad.pot -o $LOCALDIR/pofiles/$i.po 2> /dev/null fi - msgfmt --statistics $LOCALDIR/$i/kicad.po -o $LOCALDIR/messages.mo 2>&1 >>/dev/null | + msgfmt --statistics $LOCALDIR/pofiles/$i.po -o $LOCALDIR/pofiles/messages.mo 2>&1 >>/dev/null | while IFS=",." read A B C D ; do echo $A echo $B @@ -127,7 +127,7 @@ do done echo "$i;${TRANSLATED};${FUZZY};${UNTRANSLATED}">>"${CSVFILE}" done - rm $LOCALDIR/messages.mo + rm $LOCALDIR/pofiles/messages.mo done if [ "$PLOT" = "1" ]; then @@ -136,5 +136,5 @@ if [ "$PLOT" = "1" ]; then fi if [ ! "$KEEP" = "1" ]; then - rm $LOCALDIR/kicad.pot + rm $LOCALDIR/pofiles/kicad.pot fi