build: integrate po files in the build system
[project/luci.git] / Makefile
index a45d39e892e9b56fa848baf85669159ce4fe7213..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
@@ -66,6 +70,12 @@ uvldocs: hostenv
        build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) \
        "build/uvldoc $(realpath host) $(UVL_SCHEMEDIR) uvldocs $(DOCS)"
 
+po: host
+       for L in $${LANGUAGE:-$$(find i18n/ -path 'i18n/*/luasrc/i18n/*' -name 'default.*.lua' | \
+         sed -e 's!.*/default\.\(.*\)\.lua!\1!')}; do \
+           build/i18n-lua2po.pl . $(realpath host)/po $$L; \
+       done
+
 run:
        #       make run is deprecated                          #
        #       Please use:                                     #