Mercurial > octave
annotate libgui/languages/build_ts/update_ts_files @ 33658:b1d6e40ac737 stable tip
NEWS.9.md: Fix typo and minor formatting changes.
* etc/NEWS.9.md: Fix typo. Adjust whitespace. Use markdown syntax for code
snippets.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Wed, 05 Jun 2024 11:27:35 +0200 |
parents | 5ce810c981ae |
children |
rev | line source |
---|---|
31537
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
1 #!/bin/bash |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
2 |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
3 # This scripts has to be called from the folder libgui/languages |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
4 # where the *.ts files for each provided translation are located |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
5 |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
6 # The paths with libgui sources to scan for text strings |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
7 SEARCH_PATH_COMMON="../graphics ../qterminal ../src" |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
8 |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
9 # Path to Qt and QScintilla files with strings that should also be |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
10 # translated by octave in case that Qt or QScintilla does not provide |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
11 # translations for the current language |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
12 SEARCH_PATH_QT="build_ts/octave-qt" |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
13 SEARCH_PATH_QSCI="build_ts/octave-qsci" |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
14 |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
15 # The directory with translations provided by Qt and QScintilla |
32550
5ce810c981ae
update_ts_files: Prepare script to be configurable between qt5 and qt6.
Rik <rik@octave.org>
parents:
32539
diff
changeset
|
16 # FIXME: This constant should not be hardcoded. Probably best if |
5ce810c981ae
update_ts_files: Prepare script to be configurable between qt5 and qt6.
Rik <rik@octave.org>
parents:
32539
diff
changeset
|
17 # it could be picked up from the configuration such as HAVE_QTX in config.h. |
5ce810c981ae
update_ts_files: Prepare script to be configurable between qt5 and qt6.
Rik <rik@octave.org>
parents:
32539
diff
changeset
|
18 QT_VERSION="qt5" |
5ce810c981ae
update_ts_files: Prepare script to be configurable between qt5 and qt6.
Rik <rik@octave.org>
parents:
32539
diff
changeset
|
19 QT_LANG_DIR=/usr/share/$QT_VERSION/translations |
31537
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
20 |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
21 # Now update all ts files |
32539
cbdd37c5a223
update_ts_files: more comprehensive output
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31537
diff
changeset
|
22 for file in $(ls -b1 *.ts) |
cbdd37c5a223
update_ts_files: more comprehensive output
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31537
diff
changeset
|
23 do |
31537
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
24 |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
25 xx=${file:0:2} |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
26 xx_yy=${file:0:5} |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
27 |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
28 # Set the search path to the minimal one used for each ts file |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
29 SEARCH_PATH=$SEARCH_PATH_COMMON |
32539
cbdd37c5a223
update_ts_files: more comprehensive output
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31537
diff
changeset
|
30 T_QT="YES" |
cbdd37c5a223
update_ts_files: more comprehensive output
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31537
diff
changeset
|
31 T_QSCI="YES" |
31537
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
32 |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
33 # Look for translations provided by Qt and QScintilla and extend the search |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
34 # path if no existing translations are found. In this case we have to scan |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
35 # the locally collected source files. |
32550
5ce810c981ae
update_ts_files: Prepare script to be configurable between qt5 and qt6.
Rik <rik@octave.org>
parents:
32539
diff
changeset
|
36 if [ $xx_yy != "en_US" ]; then # No translation required for en_US |
31537
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
37 # Look for Qt translations |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
38 if [ "`ls $QT_LANG_DIR | grep -i qt_$xx.qm | wc -l`" -eq 0 ] && |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
39 [ "`ls $QT_LANG_DIR | grep -i qt_$xx_yy.qm | wc -l`" -eq 0 ]; then |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
40 SEARCH_PATH="$SEARCH_PATH $SEARCH_PATH_QT" |
32539
cbdd37c5a223
update_ts_files: more comprehensive output
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31537
diff
changeset
|
41 T_QT="NO" |
31537
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
42 fi |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
43 # Look for QScintilla translations |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
44 if [ "`ls $QT_LANG_DIR | grep -i qscintilla_$xx.qm | wc -l`" -eq 0 ] && |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
45 [ "`ls $QT_LANG_DIR | grep -i qscintilla_$xx_yy.qm | wc -l`" -eq 0 ]; then |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
46 SEARCH_PATH="$SEARCH_PATH $SEARCH_PATH_QSCI" |
32539
cbdd37c5a223
update_ts_files: more comprehensive output
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31537
diff
changeset
|
47 T_QSCI="NO" |
31537
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
48 fi |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
49 fi |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
50 echo |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
51 echo |
32539
cbdd37c5a223
update_ts_files: more comprehensive output
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31537
diff
changeset
|
52 echo "$xx_yy: Existing translations for Qt: $T_QT, QSci: $T_QSCI" |
31537
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
53 |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
54 # Do the update after user's confirmation |
32539
cbdd37c5a223
update_ts_files: more comprehensive output
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31537
diff
changeset
|
55 echo " => scan for strings in following paths" |
cbdd37c5a223
update_ts_files: more comprehensive output
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31537
diff
changeset
|
56 echo " => $SEARCH_PATH" |
cbdd37c5a223
update_ts_files: more comprehensive output
Torsten Lilge <ttl-octave@mailbox.org>
parents:
31537
diff
changeset
|
57 read -p " => Update (y/[n])? " ANS; |
31537
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
58 ANS=${ANS:-n} |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
59 if [ $ANS = "y" ]; then |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
60 echo |
32550
5ce810c981ae
update_ts_files: Prepare script to be configurable between qt5 and qt6.
Rik <rik@octave.org>
parents:
32539
diff
changeset
|
61 lupdate -$QT_VERSION -no-obsolete -locations relative $SEARCH_PATH -ts $file |
31537
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
62 fi |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
63 |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
64 done |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
65 |
5ceb4bfcdb0f
add tools and files for updating the gui's language files for translation
Torsten Lilge <ttl-octave@mailbox.org>
parents:
diff
changeset
|
66 echo |