ソースを参照

Extend findMissingTranslations, reformat output

Scott Lahteine 8年前
コミット
b44f06a296
1個のファイルの変更35行の追加7行の削除
  1. 35
    7
      buildroot/share/scripts/findMissingTranslations.sh

+ 35
- 7
buildroot/share/scripts/findMissingTranslations.sh ファイルの表示

@@ -1,14 +1,42 @@
1
-#!/bin/bash
1
+#!/usr/bin/env bash
2
+#
3
+# findMissingTranslations.sh
4
+#
5
+# Locate all language strings needing an update based on English
6
+#
7
+# Usage: findMissingTranslations.sh [language codes]
8
+#
9
+# If no language codes are specified then all languages will be checked
10
+#
2 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"
3 12
 
4
-for i in `awk '/#define/{print $2}' language_en.h`; do
5
-  for j in `ls language_*.h | grep -v language_en.h`; do
6
-    t=$(grep -c "${i}" ${j})
7
-    if [ "$t" -eq 0 ]; then
13
+[ -d "Marlin" ] && cd "Marlin"
14
+
15
+LANG="$@"
16
+FILES=$(ls language_*.h | grep -v language_en.h | sed -E 's/language_([^\.]+)\.h/\1/')
17
+declare -A STRING_MAP
18
+
19
+echo -n "Building list of missing strings..."
20
+
21
+for i in $(awk '/#define/{print $2}' language_en.h); do
22
+  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
8 28
       for k in ${IGNORE_DEFINES}; do
9
-        [ "${k}" == "${i}" ] && continue 2;
29
+        [[ $k == $i ]] && continue 2
10 30
       done
11
-      echo "${j},${i}"
31
+      LANG_LIST="$LANG_LIST $j"
12 32
     fi
13 33
   done
34
+  [[ -z $LANG_LIST ]] && continue
35
+  STRING_MAP["$i"]="$LANG_LIST"
36
+done
37
+
38
+echo
39
+
40
+for K in $( printf "%s\n" "${!STRING_MAP[@]}" | sort ); do
41
+  printf "%-35s :%s\n" "$K" "${STRING_MAP[$K]}"
14 42
 done

読み込み中…
キャンセル
保存