Add i18n support

This commit is contained in:
Matthias Schiffer 2015-03-18 18:14:21 +01:00
parent 8fbe5d88e0
commit 7401d02ca4
4 changed files with 83 additions and 0 deletions

View File

@ -206,6 +206,8 @@ config: FORCE
cat $(GLUONDIR)/include/config $(GLUONDIR)/targets/$(GLUON_TARGET)/config; \
echo '$(patsubst %,CONFIG_PACKAGE_%=m,$(sort $(filter-out -%,$(GLUON_DEFAULT_PACKAGES) $(GLUON_SITE_PACKAGES) $(PROFILE_PACKAGES))))' \
| sed -e 's/ /\n/g'; \
echo '$(patsubst %,CONFIG_GLUON_LANG_%=y,$(GLUON_LANGS))' \
| sed -e 's/ /\n/g'; \
) > .config
+$(NO_TRACE_MAKE) defconfig OPENWRT_BUILD=0

View File

@ -26,6 +26,9 @@ $(GLUON_SITEDIR)/site.mk:
GLUON_VERSION := $(shell cd $(GLUONDIR) && git describe --always 2>/dev/null || echo unknown)
export GLUON_VERSION
GLUON_LANGS ?= en
export GLUON_LANGS
ifeq ($(OPENWRT_BUILD),1)
ifeq ($(GLUON_TOOLS),1)

View File

@ -6,3 +6,55 @@ define GluonCheckSite
$(shell cat $(1) | sed -ne '1h; 1!H; $$ {g; s/@/+@/g; s/\n/-@/g; p}')
END__GLUON__CHECK__SITE
endef
# Languages supported by LuCi
GLUON_SUPPORTED_LANGS := ca zh_cn en fr de el he hu it ja ms no pl pt_br pt ro ru es sv uk vi
GLUON_LANG_ca := catalan
GLUON_LANG_zh_cn := chinese
GLUON_LANG_en := english
GLUON_LANG_fr := french
GLUON_LANG_de := german
GLUON_LANG_el := greek
GLUON_LANG_he := hebrew
GLUON_LANG_hu := hungarian
GLUON_LANG_it := italian
GLUON_LANG_ja := japanese
GLUON_LANG_ms := malay
GLUON_LANG_no := norwegian
GLUON_LANG_pl := polish
GLUON_LANG_pt_br := portuguese-brazilian
GLUON_LANG_pt := portuguese
GLUON_LANG_ro := romanian
GLUON_LANG_ru := russian
GLUON_LANG_es := spanish
GLUON_LANG_sv := swedish
GLUON_LANG_uk := ukrainian
GLUON_LANG_vi := vietnamese
GLUON_I18N_PACKAGES := $(foreach lang,$(GLUON_SUPPORTED_LANGS),+GLUON_LANG_$(lang):luci-i18n-$(GLUON_LANG_$(lang)))
GLUON_I18N_CONFIG := $(foreach lang,$(GLUON_SUPPORTED_LANGS),CONFIG_GLUON_LANG_$(lang))
GLUON_ENABLED_LANGS := $(foreach lang,$(GLUON_SUPPORTED_LANGS),$(if $(CONFIG_GLUON_LANG_$(lang)),$(lang)))
GLUON_PO2LMO := $(BUILD_DIR)/luci/build/po2lmo
define GluonBuildI18N
mkdir -p $$(PKG_BUILD_DIR)/i18n
for lang in $$(GLUON_ENABLED_LANGS); do \
if [ -e i18n/$$$$lang.po ]; then \
rm -f $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo; \
$(GLUON_PO2LMO) i18n/$$$$lang.po $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo; \
fi; \
done
endef
define GluonInstallI18N
$$(INSTALL_DIR) $(2)/usr/lib/lua/luci/i18n
for lang in $$(GLUON_ENABLED_LANGS); do \
if [ -e $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo ]; then \
$$(INSTALL_DATA) $$(PKG_BUILD_DIR)/i18n/$(1).$$$$lang.lmo $(2)/usr/lib/lua/luci/i18n/$(1).$$$$lang.lmo; \
fi; \
done
endef

View File

@ -0,0 +1,26 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Wed, 18 Mar 2015 20:07:22 +0100
Subject: build: define STAMP_CONFIGURED recursively
Defining STAMP_CONFIGURED statically caused it not to reflect changes to
PKG_CONFIG_DEPENDS made after including package.mk, like the additional options
added by feeds.mk for all packages.
Furthermore, as STAMP_CONFIGURED_WILDCARD was already defined recursively, the
patsubst in its definition would never match, and in consequence, the stamps
were never removed. This caused packages not to be rebuilt when they should have
been.
diff --git a/include/package.mk b/include/package.mk
index 53ca6de..402fb1a 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -60,7 +60,7 @@ ifneq ($(PREV_STAMP_PREPARED),)
else
STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPENDS),))$(call confvar,$(PKG_PREPARED_DEPENDS)))
endif
-STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured$(if $(DUMP),,_$(call confvar,$(PKG_CONFIG_DEPENDS)))
+STAMP_CONFIGURED=$(PKG_BUILD_DIR)/.configured$(if $(DUMP),,_$(call confvar,$(PKG_CONFIG_DEPENDS)))
STAMP_CONFIGURED_WILDCARD=$(patsubst %_$(call confvar,$(PKG_CONFIG_DEPENDS)),%_*,$(STAMP_CONFIGURED))
STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
STAMP_INSTALLED:=$(STAGING_DIR)/stamp/.$(PKG_NAME)_installed