File tree Expand file tree Collapse file tree 5 files changed +19
-38
lines changed
Expand file tree Collapse file tree 5 files changed +19
-38
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11To add a new translation:
22
3- - Add the language code to the `LINGUAS` file
4- - Add the .po file to the `po_files` list in `meson.build`
5- - Build the `update_all_po` target to create the new .po file
3+ - Add the name of the new .po file to the `po_files` list in `meson.build` (no need to create the file).
4+ - Build the `update_all_po` target to create the new .po file.
5+ - Edit the new .po file.
Original file line number Diff line number Diff line change 1- fs = import (' fs' )
2-
31xgettext = find_program (' xgettext' )
42msgmerge = find_program (' msgmerge' )
3+ msginit = find_program (' msginit' )
54msgfmt = find_program (' msgfmt' )
65
76po_files = [
@@ -127,6 +126,11 @@ input_files = [
127126 scanner_strings,
128127]
129128
129+ languages = []
130+ foreach po_file : po_files
131+ languages += [po_file.split(' .' )[0 ]]
132+ endforeach
133+
130134update_pot = custom_target (
131135 ' update_pot' ,
132136 output : gettext_package + ' .pot' ,
@@ -141,13 +145,14 @@ update_pot = custom_target(
141145
142146update_all_po = custom_target (
143147 ' update_all_po' ,
144- input : [ update_pot, ' LINGUAS ' ] ,
148+ input : update_pot,
145149 output : po_files,
146150 command : [
147151 ' meson_helpers/update_all_po.sh' ,
148- ' @INPUT@' ,
149- ' @OUTDIR@' ,
150152 ' @CURRENT_SOURCE_DIR@' ,
153+ ' @OUTDIR@' ,
154+ ' @INPUT@' ,
155+ languages,
151156 ],
152157)
153158
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- pot_file=$1
4- linguas_file=$2
5- build_dir=$3
6- src_dir=$4
3+ src_dir=$1
4+ build_dir=$2
5+ pot_file=$3
76
8- # Reads the LINGUAS file and outputs each word, one per line, from non-comment lines.
9- # Ignores empty lines and lines starting with # (and optional leading whitespace).
10- get_linguas () {
11- if [[ ! -f " ${linguas_file} " ]]; then
12- echo " Error: LINGUAS file not found." >&2
13- return 1
14- fi
15-
16- while IFS= read -r line || [[ -n " $line " ]]; do
17- # Skip empty lines and lines that start with # (possibly preceded by whitespace)
18- if [[ -n " $line " && ! " $line " =~ ^\s * # ]]; then
19- # Process the line: split into words and print each word on a new line.
20- # $line is intentionally unquoted here to allow word splitting by IFS.
21- for word in $line ; do
22- echo " $word "
23- done
24- fi
25- done < " ${linguas_file} "
26- }
7+ shift 3
278
28- langs= $( get_linguas)
29- for lang in $langs ; do
9+ for lang in " $@ " ; do
3010 if [[ -f " ${build_dir} /${lang} .po" ]]; then
3111 rm " ${build_dir} /${lang} .po"
3212 fi
Original file line number Diff line number Diff line change @@ -4,9 +4,8 @@ src_dir=$1
44output=$2
55
66shift 2
7- inputs=$@
87
9- xgettext ${inputs} \
8+ xgettext " $@ " \
109 --from-code=UTF-8 \
1110 --add-comments \
1211 --keyword=_ \
You can’t perform that action at this time.
0 commit comments