mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-29 23:29:41 +02:00
Various contributor script changes.
Update `msgfmt.py` to recent python 3 version. Instruct CMake to load `Gettext.Tools` version `0.21.0.1` when using NuGet. Cleanup `regen_POT_file.sh`. Correct list of languages in `LanguageNames.txt` Cleanup various locale Perl scripts. Make `find-PO-no-Id.sh` use glob file access. Cleanup output of `locale_diagnostics.sh` Cleanup bash scripts and add double-quoting to prevent string issues. Move various locale scripts to `locale/scripts` directory. Signed-off-by: Emily Mabrey <emabrey@tenacityaudio.org>
This commit is contained in:
parent
0665614b85
commit
5d8be178b5
@ -12,9 +12,9 @@ shopt -s nullglob
|
||||
input_dirs="$*"
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
input_dirs[0]="./EditButtons"
|
||||
input_dirs[1]="./TranscriptionImages"
|
||||
input_dirs[2]="./ControlButtons"
|
||||
input_dirs[0]="${BASH_SOURCE[0]}/../../images/EditButtons"
|
||||
input_dirs[1]="${BASH_SOURCE[0]}/../../images/TranscriptionImages"
|
||||
input_dirs[2]="${BASH_SOURCE[0]}/../../images/ControlButtons"
|
||||
fi
|
||||
|
||||
for dir in "${input_dirs[@]}"
|
@ -16,9 +16,9 @@ if( GETTEXT_FOUND )
|
||||
mark_as_advanced( FORCE GETTEXT_MSGMERGE_EXECUTABLE )
|
||||
set( msgfmt "${GETTEXT_MSGFMT_EXECUTABLE}" )
|
||||
elseif( PYTHON )
|
||||
set( msgfmt "${PYTHON}" "${TARGET_ROOT}/msgfmt.py" )
|
||||
set( msgfmt "${PYTHON}" "${TARGET_ROOT}/scripts/msgfmt.py" )
|
||||
elseif( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
||||
nuget_package( pkgdir "Gettext.Tools" "0.20.1.1" )
|
||||
nuget_package( pkgdir "Gettext.Tools" "0.21.0.1" )
|
||||
file( TO_NATIVE_PATH "${pkgdir}/tools/bin/msgfmt.exe" msgfmt )
|
||||
endif()
|
||||
|
||||
@ -80,9 +80,8 @@ endforeach()
|
||||
add_custom_target( "${TARGET}" ALL DEPENDS ${OUTPUTS} SOURCES "${SOURCES}" )
|
||||
|
||||
if( NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" )
|
||||
if( NOT WIN32)
|
||||
install( DIRECTORY ${locale}/
|
||||
TYPE LOCALE )
|
||||
if( NOT WIN32 )
|
||||
install( DIRECTORY ${locale} TYPE LOCALE )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -1,56 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Run this script with locale as the current directory
|
||||
set -o errexit
|
||||
echo ";; Recreating tenacity.pot using .h, .cpp and .mm files"
|
||||
for path in ../modules/mod-* ../libraries/lib-* ../include ../src ; do
|
||||
find $path -name \*.h -o -name \*.cpp -o -name \*.mm
|
||||
done | LANG=c sort | \
|
||||
sed -E 's/\.\.\///g' |\
|
||||
xargs xgettext \
|
||||
--no-wrap \
|
||||
--default-domain=tenacity \
|
||||
--directory=.. \
|
||||
--keyword=_ --keyword=XO --keyword=XC:1,2c --keyword=XXO --keyword=XXC:1,2c --keyword=XP:1,2 --keyword=XPC:1,2,4c \
|
||||
--add-comments=" i18n" \
|
||||
--add-location=file \
|
||||
--copyright-holder='Tenacity Contributors' \
|
||||
--package-name="tenacity" \
|
||||
--package-version='3.0.4' \
|
||||
--msgid-bugs-address="emabrey@tenacityaudio.org" \
|
||||
--add-location=file -L C -o tenacity.pot
|
||||
echo ";; Adding nyquist files to tenacity.pot"
|
||||
for path in ../plug-ins ; do find $path -name \*.ny -not -name rms.ny; done | LANG=c sort | \
|
||||
sed -E 's/\.\.\///g' |\
|
||||
xargs xgettext \
|
||||
--no-wrap \
|
||||
--default-domain=tenacity \
|
||||
--directory=.. \
|
||||
--keyword=_ --keyword=_C:1,2c --keyword=ngettext:1,2 --keyword=ngettextc:1,2,4c \
|
||||
--add-comments=" i18n" \
|
||||
--add-location=file \
|
||||
--copyright-holder='Tenacity Contributors' \
|
||||
--package-name="tenacity" \
|
||||
--package-version='3.0.4' \
|
||||
--msgid-bugs-address="emabrey@tenacityaudio.org" \
|
||||
--add-location=file -L Lisp -j -o tenacity.pot
|
||||
#Disable PO file modification because it will hurt Weblate merge -- emabrey.
|
||||
#if test "${TENACITY_ONLY_POT:-}" = 'y'; then
|
||||
# return 0
|
||||
#fi
|
||||
#echo ";; Updating the .po files - Updating Project-Id-Version"
|
||||
#for i in *.po; do
|
||||
# sed -e '/^"Project-Id-Version:/c\
|
||||
# "Project-Id-Version: tenacity 3.0.4\\n"' $i > TEMP; mv TEMP $i
|
||||
#done
|
||||
#echo ";; Updating the .po files"
|
||||
#sed 's/.*/echo "msgmerge --lang=& &.po tenacity.pot -o &.po";\
|
||||
#msgmerge --no-wrap --lang=& &.po tenacity.pot -o &.po;/g' LINGUAS | bash
|
||||
#echo ";; Removing '#~|' (which confuse Windows version of msgcat)"
|
||||
#for i in *.po; do
|
||||
# sed '/^#~|/d' $i > TEMP; mv TEMP $i
|
||||
#done
|
||||
#echo ""
|
||||
echo ";; POT file generated"
|
||||
echo ""
|
||||
head -n 11 tenacity.pot | tail -n 3
|
||||
wc -l tenacity.pot
|
@ -5,7 +5,7 @@ bg Български
|
||||
bn বাংলা
|
||||
bs Bosanski
|
||||
ca Català
|
||||
ca_ES@valencia Valencià
|
||||
ca@valencia Valencià
|
||||
co Corsu
|
||||
cs Čeština
|
||||
cy Cymraeg
|
||||
@ -15,7 +15,6 @@ el Ελληνικά
|
||||
en English
|
||||
es Español
|
||||
eu Euskara
|
||||
eu_ES Euskara (Espainiako)
|
||||
fa فارسی
|
||||
fi Suomi
|
||||
fr Français
|
||||
@ -40,19 +39,19 @@ nb Norsk
|
||||
nl Nederlands
|
||||
oc Occitan
|
||||
pl Polski
|
||||
pt Português
|
||||
pt_PT Português
|
||||
pt_BR Português (Brasil)
|
||||
ro Română
|
||||
ru Русский
|
||||
sk Slovenčina
|
||||
sl Slovenščina
|
||||
sr_RS Српски
|
||||
sr_RS@latin Srpski
|
||||
sr Српски
|
||||
sr_Latn Srpski
|
||||
sv Svenska
|
||||
ta தமிழ்
|
||||
tg Тоҷикӣ
|
||||
tr Türkçe
|
||||
uk Українська
|
||||
vi Tiếng Việt
|
||||
zh_CN 中文(简体)
|
||||
zh_TW 中文(繁體)
|
||||
zh 中文(简体)
|
||||
zh_Hant 中文(繁體)
|
18
locale/scripts/find-PO-no-Id.sh
Normal file
18
locale/scripts/find-PO-no-Id.sh
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Run this script on a directory to handle PO files with no id
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
input_dirs="$*"
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
input_dirs[0]="${BASH_SOURCE[0]}/../"
|
||||
fi
|
||||
|
||||
for dir in "${input_dirs[@]}"
|
||||
do
|
||||
for po_file in "${dir}"/*.po; do
|
||||
sed -i '/^Project/d' "$po_file"
|
||||
done
|
||||
done
|
3
locale/find-duplicates.pl → locale/scripts/find-POT-duplicates.pl
Executable file → Normal file
3
locale/find-duplicates.pl → locale/scripts/find-POT-duplicates.pl
Executable file → Normal file
@ -2,8 +2,7 @@
|
||||
|
||||
use strict 'vars';
|
||||
|
||||
open(my $fh, "<", "audacity.pot")
|
||||
or die "Can't open < audacity.pot: $!";
|
||||
open(my $fh, "<", "../tenacity.pot") or die "Can't open < ../tenacity.pot: $!";
|
||||
|
||||
my @sourcelines = ();
|
||||
|
@ -1,7 +1,7 @@
|
||||
import polib
|
||||
import os
|
||||
|
||||
localedir = './'
|
||||
localedir = '../'
|
||||
count_seen = 0
|
||||
count_modified = 0
|
||||
|
0
locale/CeePlusPlusifyLanguageNames.pl → locale/scripts/locale_cpp_name_generator.pl
Executable file → Normal file
0
locale/CeePlusPlusifyLanguageNames.pl → locale/scripts/locale_cpp_name_generator.pl
Executable file → Normal file
23
locale/scripts/locale_diagnostics.sh
Normal file
23
locale/scripts/locale_diagnostics.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Report how complete each translation catalog is
|
||||
|
||||
# How many messages in total?
|
||||
total=$(grep -c '^msgid' "${BASH_SOURCE[0]}/../tenacity.pot")
|
||||
|
||||
|
||||
declare -i badlines
|
||||
for po_file in "${BASH_SOURCE[0]}/../"*.po; do
|
||||
# If there are errors from msgcmp, then the last line on standard error
|
||||
# contains a count of problematic messages; else it won't match the
|
||||
# pattern in awk, so assume no errors
|
||||
errors=$(msgcmp "$po_file" "${BASH_SOURCE[0]}/../tenacity.pot" 2>&1 | awk '/msgcmp: found [0-9]* fatal error/ { nn = $3 } END {print 0+nn}')
|
||||
complete=$((total-errors))
|
||||
|
||||
# detect whether this sequence occurs in any .po file. It will break msgfmt on Windows.
|
||||
badlines=$(grep -F -c '#~|' "${po_file}")
|
||||
|
||||
echo "$po_file: completed $complete of $total ($((complete*100/total))%); Windows Incompatible Lines: $badlines"
|
||||
done | sort -n -t , -k3
|
||||
|
||||
exit 0
|
@ -5,8 +5,7 @@
|
||||
|
||||
This program converts a textual Uniforum-style message catalog (.po file) into
|
||||
a binary GNU catalog (.mo file). This is essentially the same function as the
|
||||
GNU msgfmt program, however, it is a simpler implementation. Currently it
|
||||
does not handle plural forms but it does handle message contexts.
|
||||
GNU msgfmt program, however, it is a simpler implementation.
|
||||
|
||||
Usage: msgfmt.py [OPTIONS] filename.po
|
||||
|
||||
@ -33,11 +32,12 @@ import struct
|
||||
import array
|
||||
from email.parser import HeaderParser
|
||||
|
||||
__version__ = "1.2"
|
||||
__version__ = "1.1"
|
||||
|
||||
MESSAGES = {}
|
||||
|
||||
|
||||
|
||||
def usage(code, msg=''):
|
||||
print(__doc__, file=sys.stderr)
|
||||
if msg:
|
||||
@ -45,16 +45,15 @@ def usage(code, msg=''):
|
||||
sys.exit(code)
|
||||
|
||||
|
||||
def add(ctxt, id, str, fuzzy):
|
||||
|
||||
def add(id, str, fuzzy):
|
||||
"Add a non-fuzzy translation to the dictionary."
|
||||
global MESSAGES
|
||||
if not fuzzy and str:
|
||||
if ctxt is None:
|
||||
MESSAGES[id] = str
|
||||
else:
|
||||
MESSAGES[b"%b\x04%b" % (ctxt, id)] = str
|
||||
MESSAGES[id] = str
|
||||
|
||||
|
||||
|
||||
def generate():
|
||||
"Return the generated output."
|
||||
global MESSAGES
|
||||
@ -96,10 +95,10 @@ def generate():
|
||||
return output
|
||||
|
||||
|
||||
|
||||
def make(filename, outfile):
|
||||
ID = 1
|
||||
STR = 2
|
||||
CTXT = 3
|
||||
|
||||
# Compute .mo name from .po name and arguments
|
||||
if filename.endswith('.po'):
|
||||
@ -116,7 +115,7 @@ def make(filename, outfile):
|
||||
print(msg, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
section = msgctxt = None
|
||||
section = None
|
||||
fuzzy = 0
|
||||
|
||||
# Start off assuming Latin-1, so everything decodes without failure,
|
||||
@ -130,8 +129,8 @@ def make(filename, outfile):
|
||||
lno += 1
|
||||
# If we get a comment line after a msgstr, this is a new entry
|
||||
if l[0] == '#' and section == STR:
|
||||
add(msgctxt, msgid, msgstr, fuzzy)
|
||||
section = msgctxt = None
|
||||
add(msgid, msgstr, fuzzy)
|
||||
section = None
|
||||
fuzzy = 0
|
||||
# Record a fuzzy mark
|
||||
if l[:2] == '#,' and 'fuzzy' in l:
|
||||
@ -139,16 +138,10 @@ def make(filename, outfile):
|
||||
# Skip comments
|
||||
if l[0] == '#':
|
||||
continue
|
||||
# Now we are in a msgid or msgctxt section, output previous section
|
||||
if l.startswith('msgctxt'):
|
||||
# Now we are in a msgid section, output previous section
|
||||
if l.startswith('msgid') and not l.startswith('msgid_plural'):
|
||||
if section == STR:
|
||||
add(msgctxt, msgid, msgstr, fuzzy)
|
||||
section = CTXT
|
||||
l = l[7:]
|
||||
msgctxt = b''
|
||||
elif l.startswith('msgid') and not l.startswith('msgid_plural'):
|
||||
if section == STR:
|
||||
add(msgctxt, msgid, msgstr, fuzzy)
|
||||
add(msgid, msgstr, fuzzy)
|
||||
if not msgid:
|
||||
# See whether there is an encoding declaration
|
||||
p = HeaderParser()
|
||||
@ -190,9 +183,7 @@ def make(filename, outfile):
|
||||
if not l:
|
||||
continue
|
||||
l = ast.literal_eval(l)
|
||||
if section == CTXT:
|
||||
msgctxt += l.encode(encoding)
|
||||
elif section == ID:
|
||||
if section == ID:
|
||||
msgid += l.encode(encoding)
|
||||
elif section == STR:
|
||||
msgstr += l.encode(encoding)
|
||||
@ -203,7 +194,7 @@ def make(filename, outfile):
|
||||
sys.exit(1)
|
||||
# Add last entry
|
||||
if section == STR:
|
||||
add(msgctxt, msgid, msgstr, fuzzy)
|
||||
add(msgid, msgstr, fuzzy)
|
||||
|
||||
# Compute output
|
||||
output = generate()
|
||||
@ -215,6 +206,7 @@ def make(filename, outfile):
|
||||
print(msg, file=sys.stderr)
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], 'hVo:',
|
44
locale/scripts/regen_POT_file.sh
Normal file
44
locale/scripts/regen_POT_file.sh
Normal file
@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
# Run this script with /locale/script/ as the current directory
|
||||
set -o errexit
|
||||
|
||||
echo ";; Recreating tenacity.pot using .h, .cpp and .mm files"
|
||||
for path in "${BASH_SOURCE[0]}/../modules/mod-*" "${BASH_SOURCE[0]}/../libraries/lib-*" "${BASH_SOURCE[0]}/../include" "${BASH_SOURCE[0]}/../src" ; do
|
||||
find "$path" -name \*.h -o -name \*.cpp -o -name \*.mm
|
||||
done | LANG=c sort | \
|
||||
sed -E 's/\.\.\///g' |\
|
||||
xargs xgettext \
|
||||
--no-wrap \
|
||||
--default-domain=tenacity \
|
||||
--directory="${BASH_SOURCE[0]}/../.." \
|
||||
--keyword=_ --keyword=XO --keyword=XC:1,2c --keyword=XXO --keyword=XXC:1,2c --keyword=XP:1,2 --keyword=XPC:1,2,4c \
|
||||
--add-comments=" i18n" \
|
||||
--add-location=file \
|
||||
--copyright-holder='Tenacity Contributors' \
|
||||
--package-name="tenacity" \
|
||||
--package-version='3.0.4' \
|
||||
--msgid-bugs-address="emabrey@tenacityaudio.org" \
|
||||
--add-location=file -L C -o "${BASH_SOURCE[0]}/../tenacity.pot"
|
||||
|
||||
echo ";; Adding nyquist files to tenacity.pot"
|
||||
for path in "${BASH_SOURCE[0]}/../../plug-ins/"* ; do find "$path" -name \*.ny -not -name rms.ny; done | LANG=c sort | \
|
||||
sed -E 's/\.\.\///g' |\
|
||||
xargs xgettext \
|
||||
--no-wrap \
|
||||
--default-domain=tenacity \
|
||||
--directory="${BASH_SOURCE[0]}/../.." \
|
||||
--keyword=_ --keyword=_C:1,2c --keyword=ngettext:1,2 --keyword=ngettextc:1,2,4c \
|
||||
--add-comments=" i18n" \
|
||||
--add-location=file \
|
||||
--copyright-holder='Tenacity Contributors' \
|
||||
--package-name="tenacity" \
|
||||
--package-version='3.0.4' \
|
||||
--msgid-bugs-address="emabrey@tenacityaudio.org" \
|
||||
--add-location=file -L Lisp -j -o "${BASH_SOURCE[0]}/../tenacity.pot"
|
||||
|
||||
echo ""
|
||||
echo ";; POT file generated"
|
||||
echo ""
|
||||
|
||||
head -n 11 "${BASH_SOURCE[0]}/../tenacity.pot" | tail -n 3
|
||||
wc -l "${BASH_SOURCE[0]}/../tenacity.pot"
|
@ -1,55 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Run this script with locale as the current directory
|
||||
set -o errexit
|
||||
echo ";; Recreating tenacity.pot using .h, .cpp and .mm files"
|
||||
for path in ../modules/mod-* ../libraries/lib-* ../include ../src ; do
|
||||
find $path -name \*.h -o -name \*.cpp -o -name \*.mm
|
||||
done | LANG=c sort | \
|
||||
sed -E 's/\.\.\///g' |\
|
||||
xargs xgettext \
|
||||
--no-wrap \
|
||||
--default-domain=tenacity \
|
||||
--directory=.. \
|
||||
--keyword=_ --keyword=XO --keyword=XC:1,2c --keyword=XXO --keyword=XXC:1,2c --keyword=XP:1,2 --keyword=XPC:1,2,4c \
|
||||
--add-comments=" i18n" \
|
||||
--add-location=file \
|
||||
--copyright-holder='Tenacity Contributors' \
|
||||
--package-name="tenacity" \
|
||||
--package-version='3.0.4' \
|
||||
--msgid-bugs-address="emabrey@tenacityaudio.org" \
|
||||
--add-location=file -L C -o tenacity.pot
|
||||
echo ";; Adding nyquist files to tenacity.pot"
|
||||
for path in ../plug-ins ; do find $path -name \*.ny -not -name rms.ny; done | LANG=c sort | \
|
||||
sed -E 's/\.\.\///g' |\
|
||||
xargs xgettext \
|
||||
--no-wrap \
|
||||
--default-domain=tenacity \
|
||||
--directory=.. \
|
||||
--keyword=_ --keyword=_C:1,2c --keyword=ngettext:1,2 --keyword=ngettextc:1,2,4c \
|
||||
--add-comments=" i18n" \
|
||||
--add-location=file \
|
||||
--copyright-holder='Tenacity Contributors' \
|
||||
--package-name="tenacity" \
|
||||
--package-version='3.0.4' \
|
||||
--msgid-bugs-address="emabrey@tenacityaudio.org" \
|
||||
--add-location=file -L Lisp -j -o tenacity.pot
|
||||
if test "${TENACITY_ONLY_POT:-}" = 'y'; then
|
||||
return 0
|
||||
fi
|
||||
echo ";; Updating the .po files - Updating Project-Id-Version"
|
||||
for i in *.po; do
|
||||
sed -e '/^"Project-Id-Version:/c\
|
||||
"Project-Id-Version: tenacity 3.0.4\\n"' $i > TEMP; mv TEMP $i
|
||||
done
|
||||
echo ";; Updating the .po files"
|
||||
sed 's/.*/echo "msgmerge --lang=& &.po tenacity.pot -o &.po";\
|
||||
msgmerge --no-wrap --lang=& &.po tenacity.pot -o &.po;/g' LINGUAS | bash
|
||||
echo ";; Removing '#~|' (which confuse Windows version of msgcat)"
|
||||
for i in *.po; do
|
||||
sed '/^#~|/d' $i > TEMP; mv TEMP $i
|
||||
done
|
||||
echo ""
|
||||
echo ";;Translation updated"
|
||||
echo ""
|
||||
head -n 11 tenacity.pot | tail -n 3
|
||||
wc -l tenacity.pot
|
Loading…
x
Reference in New Issue
Block a user