build: integrate po files in the build system
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 19 May 2009 02:18:28 +0000 (02:18 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 19 May 2009 02:18:28 +0000 (02:18 +0000)
36 files changed:
Makefile
applications/luci-asterisk/Makefile
applications/luci-coovachilli/Makefile
applications/luci-ddns/Makefile
applications/luci-ffwizard-leipzig/Makefile
applications/luci-fw/Makefile
applications/luci-hd_idle/Makefile
applications/luci-initmgr/Makefile
applications/luci-livestats/Makefile
applications/luci-mmc_over_gpio/Makefile
applications/luci-ntpc/Makefile
applications/luci-olsr/Makefile
applications/luci-openvpn/Makefile
applications/luci-p910nd/Makefile
applications/luci-polipo/Makefile
applications/luci-qos/Makefile
applications/luci-samba/Makefile
applications/luci-siitwizard/Makefile
applications/luci-splash/Makefile
applications/luci-statistics/Makefile
applications/luci-tinyproxy/Makefile
applications/luci-upnp/Makefile
applications/luci-ushare/Makefile
applications/luci-uvc_streamer/Makefile
build/i18n-po2lua.pl
build/module.mk
i18n/english/Makefile
i18n/french/Makefile
i18n/german/Makefile
i18n/greek/Makefile
i18n/italian/Makefile
i18n/japanese/Makefile
i18n/portuguese_brazilian/Makefile
i18n/russian/Makefile
libs/uvl/Makefile
modules/freifunk/Makefile

index 0f0d3aabc6ee515d3c94e90d1b7c7d92260caf27..1b9e25916f913ded884c6f65deb5859f1f96d8f1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -14,8 +14,12 @@ build: gccbuild luabuild
 gccbuild:
        for i in $(MODULES); do make -C$$i compile; done
 
-luabuild:
-       for i in $(MODULES); do make -C$$i luabuild; done
+luabuild: i18nbuild
+       for i in $(MODULES); do HOST=$(realpath host) make -C$$i luabuild; done
+
+i18nbuild:
+       mkdir -p host/lua-po
+       ./build/i18n-po2lua.pl ./po host/lua-po
 
 clean:
        rm -rf docs
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..1b8cf53cd2128c1a6324d78a6c7ff2ab114106e2 100644 (file)
@@ -1,2 +1,4 @@
+PO = asterisk
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..a98ccb8473cce50d42ff0548076bb35be719f53c 100644 (file)
@@ -1,2 +1,4 @@
+PO = coovachilli
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..3f57d63c6974f3a49ca5f1cfe3259834e12d5114 100644 (file)
@@ -1,2 +1,4 @@
+PO = ddns
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..a4f7c76ef9315b253b85cd2024535c743ebaca1f 100644 (file)
@@ -1,2 +1,4 @@
+PO = 
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..87e881d950ff12b671d1a4c7ea05006fb5032122 100644 (file)
@@ -1,2 +1,4 @@
+PO = luci-fw
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..d70bb8789cdf985dbc552c21e8f817531b74c972 100644 (file)
@@ -1,2 +1,4 @@
+PO = hd_idle
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..5e05cb74236b9d5ccec3b2d8bccae676d154e3b5 100644 (file)
@@ -1,2 +1,4 @@
+PO = initmgr
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..9ee051cd7befc1746efed7babb4bbcdf9e0e36b7 100644 (file)
@@ -1,2 +1,4 @@
+PO = livestats
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index f7fac7740e84c3d1c6eab2347fc2f0bb694fb7a1..3f031cb7136e5432602362c1280346b377bfc332 100644 (file)
@@ -1,2 +1,4 @@
+PO = mmc_over_gpio
+
 include ../../build/config.mk
 include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..392e8fed10cefbacc08429ea19f752a0c929e527 100644 (file)
@@ -1,2 +1,4 @@
+PO = ntpc
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..119cffc91919a880d2fc369869d7cf0278cdc397 100644 (file)
@@ -1,2 +1,4 @@
+PO = olsr
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..f394a81725a8b9a840755535e5ece5d898252762 100644 (file)
@@ -1,2 +1,4 @@
+PO = openvpn
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index f7fac7740e84c3d1c6eab2347fc2f0bb694fb7a1..30073fbd59dea81ec6b676ea803a5bd3dddbf7c5 100644 (file)
@@ -1,2 +1,4 @@
+PO = p910nd
+
 include ../../build/config.mk
 include ../../build/module.mk
index f7fac7740e84c3d1c6eab2347fc2f0bb694fb7a1..4f5743f443d16dde2d17825b7c23050b98dabeda 100644 (file)
@@ -1,2 +1,4 @@
+PO = polipo
+
 include ../../build/config.mk
 include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..ef79869a30b4062624527f673839351f08467fb0 100644 (file)
@@ -1,2 +1,4 @@
+PO = qos
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..e91079bb0add64e3966af0f77c813d1835b633a6 100644 (file)
@@ -1,2 +1,4 @@
+PO = samba
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..a4f7c76ef9315b253b85cd2024535c743ebaca1f 100644 (file)
@@ -1,2 +1,4 @@
+PO = 
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..a4f7c76ef9315b253b85cd2024535c743ebaca1f 100644 (file)
@@ -1,2 +1,4 @@
+PO = 
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..ff3d67021c7c5cf6f59d0232afdf197e810940bb 100644 (file)
@@ -1,2 +1,4 @@
+PO = statistics rrdtool
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..0123c164b0daf0b442b86ebb4bfae6366ba49f4b 100644 (file)
@@ -1,2 +1,4 @@
+PO = tinyproxy
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..2f850c618e0bbb3510ba142ae792309865cde91f 100644 (file)
@@ -1,2 +1,4 @@
+PO = upnp
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index f7fac7740e84c3d1c6eab2347fc2f0bb694fb7a1..9b0a6e4abd87dc2bc220ecc77b7439ed86f47b82 100644 (file)
@@ -1,2 +1,4 @@
+PO = ushare
+
 include ../../build/config.mk
 include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..eb78c9382be0693731ea8d674271951bf999ff3a 100644 (file)
@@ -1,2 +1,4 @@
+PO = uvc_streamer
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 38e6529bb7a99c2db225055106fbe37be76cffbd..8466fd9890c61cb559825c34fdce947864e62a58 100755 (executable)
@@ -20,11 +20,14 @@ if( open F, "find $source_dir -type f -name '*.po' |" )
        {
                if( open L, "< $file" )
                {
-                       my ( $basename ) = $file =~ m{.+/([^/]+\.[\w\-]+)\.po$};
-
-                       if( open D, "> $target_dir/$basename.lua" )
+                       my $content = 0;
+                       my ( $lang, $basename ) = $file =~ m{.+/(\w+)/([^/]+)\.po$};
+                       $lang = lc $lang;
+                       $lang =~ s/_/-/g;
+                       
+                       if( open D, "> $target_dir/$basename.$lang.lua" )
                        {
-                               printf "Generating %-40s ", "$target_dir/$basename.lua";
+                               printf "Generating %-40s ", "$target_dir/$basename.$lang.lua";
 
                                my ( $k, $v );
 
@@ -44,21 +47,26 @@ if( open F, "find $source_dir -type f -name '*.po' |" )
                                        }
                                        else
                                        {
-                                               if( $k && defined($v) )
+                                               if( $k && defined($v) && length($v) > 0 )
                                                {
                                                        $v =~ s/\\(['"\\])/$1/g;
                                                        $v =~ s/(['\\])/\\$1/g;
 
-                                                       printf D "%s%s='%s'\n", $v ? '' : '--', $k, $v;
+                                                       printf D "%s='%s'\n", $k, $v;
+                                                       $content++;
                                                }
                
                                                $k = $v = undef;
                                        }
                                }
 
-                               print "done\n";
+                               print $content ? "done ($content strings)\n" : "empty\n";
 
                                close D;
+
+
+                               unlink("$target_dir/$basename.$lang.lua")
+                                       unless( $content > 0 );
                        }
 
                        close L;
index de86855beaf0a623b6aefadf5fee278db769ecc2..6aeb9ba56eaa909f4e7b126fe09a1acdcfa0089d 100644 (file)
@@ -8,17 +8,13 @@ all: build
 
 build: luabuild gccbuild
 
-luabuild: i18n lua$(LUA_TARGET)
+luabuild: lua$(LUA_TARGET)
 
 gccbuild: compile
 compile:
 
 clean: luaclean
 
-i18n:
-       [ -n "$(XSLTPROC)" ] && for i in luasrc/i18n/*.xml; do [ "$$i" -nt "$${i%%[.]xml}.lua" ]\
-       && $(XSLTPROC) $(MAKEPATH)i18n-lua-xhtml1.xsl $$i > $${i%%[.]xml}.lua; done || true
-
 luasource:
        mkdir -p dist$(LUA_MODULEDIR)
        mkdir -p dist$(LUCI_MODULEDIR)
@@ -28,7 +24,11 @@ luasource:
        cp -pR lua/* dist$(LUA_MODULEDIR) 2>/dev/null || true
        cp -pR htdocs/* dist$(HTDOCS) 2>/dev/null || true
        for i in $$(find dist -name .svn -or -name .gitignore); do rm -rf $$i || true; done
-       for i in dist$(LUCI_MODULEDIR)/i18n/*.xml; do [ -f "$$i" ] && rm $$i; done || true
+  ifneq ($(PO),)
+       for file in $(PO); do \
+         cp $(HOST)/lua-po/$$file.*.lua dist$(LUCI_MODULEDIR)/i18n/; \
+       done
+  endif
 
 
 luastrip: luasource
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..7e4c710f70158adef18c349ceb03928ec705118f 100644 (file)
@@ -1,2 +1,4 @@
+PO = default cbi admin-core sysauth wifi
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..7e4c710f70158adef18c349ceb03928ec705118f 100644 (file)
@@ -1,2 +1,4 @@
+PO = default cbi admin-core sysauth wifi
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..7e4c710f70158adef18c349ceb03928ec705118f 100644 (file)
@@ -1,2 +1,4 @@
+PO = default cbi admin-core sysauth wifi
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..7e4c710f70158adef18c349ceb03928ec705118f 100644 (file)
@@ -1,2 +1,4 @@
+PO = default cbi admin-core sysauth wifi
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..7e4c710f70158adef18c349ceb03928ec705118f 100644 (file)
@@ -1,2 +1,4 @@
+PO = default cbi admin-core sysauth wifi
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..7e4c710f70158adef18c349ceb03928ec705118f 100644 (file)
@@ -1,2 +1,4 @@
+PO = default cbi admin-core sysauth wifi
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..7e4c710f70158adef18c349ceb03928ec705118f 100644 (file)
@@ -1,2 +1,4 @@
+PO = default cbi admin-core sysauth wifi
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..7e4c710f70158adef18c349ceb03928ec705118f 100644 (file)
@@ -1,2 +1,4 @@
+PO = default cbi admin-core sysauth wifi
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..7901e229b10595c3b90dfcf82bcb7a80375a2611 100644 (file)
@@ -1,2 +1,4 @@
+PO = uvl
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk
index 81a96f6a83ab4f206d7f63a674b53af6312a7d94..82c5b1324e37e34aaea5e088c14159caf0273f23 100644 (file)
@@ -1,2 +1,4 @@
+PO = freifunk
+
 include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+include ../../build/module.mk