-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStaticMessages.sh
executable file
·62 lines (59 loc) · 2.49 KB
/
StaticMessages.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
EXPORTS_POT_DIR=1
FILE_PREFIX=docs_kdenlive_org_
function export_pot_dir # First parameter will be the path of the directory where we have to store the pot files
{
echo "Creating POT files in $1"
if ! make gettext; then
echo "Pot dir export aborted because of failing make gettext"
return;
fi
potdir=$1
cd build/gettext
#rm -rf untranslatable_pages.pot untranslatable_pages
# Flatten the dir structure
echo "> Add docs_kdenlive_org_ prefix"
find * -type f -exec bash -c 'new=$(echo "{}" | sed s#/#___#g); mv "{}" "docs_kdenlive_org_$new"' \;
echo "> Move files to $1"
mv *.pot $potdir
#echo "> clean up"
#rm -rf *
}
function import_po_dirs # First parameter will be a path that will be a directory to the dirs for each lang and then all the .po files inside
{
# echo "Import PO dirs: $1"
podir=$1
mkdir -p locale
# for some reason sphinx uses nb_NO instead of nb
if [ -d $podir/nb ]; then
mv $podir/nb $podir/nb_NO
fi
# for some reason sphinx uses uk_UA instead of uk
if [ -d $podir/uk ]; then
mv $podir/uk $podir/uk_UA
fi
# for some reason sphinx uses pt_PT instead of pt
if [ -d $podir/pt ]; then
mv $podir/pt $podir/pt_PT
fi
# These are the language codes that sphinx supports.
# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-language
# -> Languages supported by sphinx, but not supported by KDEs l10n: cak – Kaqchikel, hi_IN – Hindi (India),
# sr@latin – Serbian (Latin), sr_RS – Serbian (Cyrillic), ur – Urdu
for lang in ar bg bn ca cs cy da de el eo es et eu fa fi fr he hi hr hu id it ja ko lt lv mk nb_NO ne nl pl pt_BR pt_PT ro ru si sk sl sq sr sv ta te tr uk_UA vi zh_CN zh_TW
do
if [ -d "$podir/$lang" ]; then
echo "> processing language $lang"
rm -rf locale/$lang/LC_MESSAGES
mkdir -p locale/$lang/LC_MESSAGES
echo locale/$lang/LC_MESSAGES
mv $podir/$lang/*.po locale/$lang/LC_MESSAGES
cd locale/$lang/LC_MESSAGES
# Recreate the dir structure
find * -type f -exec bash -c 'new=$(echo "{}" | sed s#docs_kdenlive_org_##g | sed s#___#/#g); mkdir -p `dirname $new`; mv "{}" $new' \;
cd ../../..
rm -rf $podir/$lang
fi
done
ls $podir # This will "complain" about languages that are translated but unsupported in sphinx, once we have one we'll have to think what to do
}