Kaynağa Gözat

Optimize findMissingTranslations.sh

Scott Lahteine 8 yıl önce
ebeveyn
işleme
29bc83ead8
1 değiştirilmiş dosya ile 17 ekleme ve 15 silme
  1. 17
    15
      buildroot/share/scripts/findMissingTranslations.sh

+ 17
- 15
buildroot/share/scripts/findMissingTranslations.sh Dosyayı Görüntüle

@@ -8,31 +8,33 @@
8 8
 #
9 9
 # If no language codes are specified then all languages will be checked
10 10
 #
11
-IGNORE_DEFINES="LANGUAGE_EN_H MAPPER_NON SIMULATE_ROMFONT DISPLAY_CHARSET_ISO10646_1 MSG_X MSG_Y MSG_Z MSG_E MSG_H1 MSG_H2 MSG_H3 MSG_H4 MSG_MOVE_E1 MSG_MOVE_E2 MSG_MOVE_E3 MSG_MOVE_E4 MSG_N1 MSG_N2 MSG_N3 MSG_N4 MSG_DIAM_E1 MSG_DIAM_E2 MSG_DIAM_E3 MSG_DIAM_E4 MSG_E1 MSG_E2 MSG_E3 MSG_E4"
12 11
 
13 12
 [ -d "Marlin" ] && cd "Marlin"
14 13
 
15
-LANG="$@"
16
-FILES=$(ls language_*.h | grep -v language_en.h | sed -E 's/language_([^\.]+)\.h/\1/')
14
+FILES=$(ls language_*.h | grep -v -E "(_en|_test)\.h" | sed -E 's/language_([^\.]+)\.h/\1/')
17 15
 declare -A STRING_MAP
18 16
 
17
+# Get files matching the given arguments
18
+TEST_LANGS=$FILES
19
+if [[ -n $@ ]]; then
20
+  TEST_LANGS=""
21
+  for K in "$@"; do
22
+    for F in $FILES; do
23
+      [[ "$F" != "${F%$K*}" ]] && TEST_LANGS="$TEST_LANGS $F"
24
+    done
25
+  done
26
+fi
27
+
19 28
 echo -n "Building list of missing strings..."
20 29
 
21
-for i in $(awk '/#define/{print $2}' language_en.h); do
30
+for i in $(awk '/#ifndef/{print $2}' language_en.h); do
31
+  [[ $i == "LANGUAGE_EN_H" ]] && continue
22 32
   LANG_LIST=""
23
-  for j in $FILES; do
24
-    [[ $j == "test" ]] && continue
25
-    [[ -n $LANG && ! "${j}" =~ $LANG ]] && continue
26
-    t=$(grep -c "define ${i} " language_${j}.h)
27
-    if [[ $t -eq 0 ]]; then
28
-      for k in ${IGNORE_DEFINES}; do
29
-        [[ $k == $i ]] && continue 2
30
-      done
31
-      LANG_LIST="$LANG_LIST $j"
32
-    fi
33
+  for j in $TEST_LANGS; do
34
+    [[ $(grep -c " ${i} " language_${j}.h) -eq 0 ]] && LANG_LIST="$LANG_LIST $j"
33 35
   done
34 36
   [[ -z $LANG_LIST ]] && continue
35
-  STRING_MAP["$i"]="$LANG_LIST"
37
+  STRING_MAP[$i]=$LANG_LIST
36 38
 done
37 39
 
38 40
 echo

Loading…
İptal
Kaydet