OSDN Git Service

LDP: new script to find ja.po for a page
authorAkihiro MOTOKI <amotoki@gmail.com>
Sun, 18 Aug 2013 09:31:52 +0000 (18:31 +0900)
committerAkihiro MOTOKI <amotoki@gmail.com>
Sun, 18 Aug 2013 09:31:52 +0000 (18:31 +0900)
Added tools/identify-po.sh

manual/LDP_man-pages/README.JM.org
manual/LDP_man-pages/tools/identify-po.sh [new file with mode: 0755]

index a247127..408a53d 100644 (file)
@@ -29,22 +29,16 @@ make jm-setup
 *** ja.po と man page の関係
 
 一つの po ファイルは、 LDP\_man-pages の複数の man page に対応しています。
-man page ã\81«å¯¾å¿\9cã\81\99ã\82\8b po ã\83\95ã\82¡ã\82¤ã\83«ã\82\92ç\89¹å®\9aã\81\99ã\82\8bã\81«ã\81¯ã\80\81以ä¸\8bã\81®ã\82\88ã\81\86ã\81«します。
+man page ã\81«å¯¾å¿\9cã\81\99ã\82\8b po ã\83\95ã\82¡ã\82¤ã\83«ã\82\92ç\89¹å®\9aã\81\99ã\82\8bã\81«ã\81¯ã\80\81以ä¸\8bã\81®ã\82³ã\83\9eã\83³ã\83\89ã\82\92å®\9fè¡\8cします。
 
 #+BEGIN_EXAMPLE
-$ grep -l strptime.3 perkamon/po4a/*/*.cfg
-perkamon/po4a/time/time.cfg
+$ ./tools/identify-po.sh strptime.3
+strptime.3 -> po4a/time/po/ja.po
 #+END_EXAMPLE
 
 上記の場合、strptime.3 が含まれる po ファイル (ja.po) は time 以下にあります。
 po4a/time/po/ja.po を翻訳することになります。
 
-#+BEGIN_EXAMPLE
-$ find po4a/time/ -type f
-po4a/time/po/ja.po
-po4a/time/po/time.pot
-#+END_EXAMPLE
-
 *** 翻訳
 
 上記で特定した ja.po を翻訳します。
diff --git a/manual/LDP_man-pages/tools/identify-po.sh b/manual/LDP_man-pages/tools/identify-po.sh
new file mode 100755 (executable)
index 0000000..eecef29
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+usage() {
+    cat <<-EOF
+       Usage: $0 <pagename>
+       
+       Examples:
+         $0 arp.7
+         $0 draft/man7/arp.7
+       EOF
+    exit 1
+}
+
+if [ "$1" = "" ]; then
+    usage
+fi
+PAGENAME=$(basename $1)
+
+DIR=$(pwd)
+if [ $(basename $DIR) != "LDP_man-pages" ]; then
+    echo "[ERROR] Please run in LDP_man-pages top directory!"
+    exit 1
+fi
+
+CFG=$(grep -l $PAGENAME perkamon/po4a/*/*.cfg)
+if [ -z "$CFG" ]; then
+    echo "[ERROR] PO file for $PAGENAME is not found!"
+    exit 2
+fi
+SEC=$(echo $CFG | cut -d / -f 3)
+POFILE=po4a/$SEC/po/ja.po
+echo "$PAGENAME -> $POFILE"