Skip to content

Commit

Permalink
Make lime-webui translations modular
Browse files Browse the repository at this point in the history
 - languages can be independently selected via menuconfig or tag CONFIG_LIMEWEBUI_{LANG}=y
 - custom lmo files are only copied if the translation exist and is selected

Add lime-webui support for Portuguese and German translations

Signed-off-by: Pau Escrich <p4u@dabax.net>
  • Loading branch information
p4u committed Mar 10, 2017
1 parent fcd147f commit cede7b0
Showing 1 changed file with 38 additions and 7 deletions.
45 changes: 38 additions & 7 deletions packages/lime-webui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,49 @@ PKG_NAME:=lime-webui
PKG_VERSION=$(GIT_COMMIT_DATE)-$(GIT_COMMIT_TSTAMP)
GIT_COMMIT_DATE:=$(shell git log -n 1 --pretty=%ad --date=short . )
GIT_COMMIT_TSTAMP:=$(shell git log -n 1 --pretty=%at . )

LIME_CODENAME:=communitychaos

include $(INCLUDE_DIR)/package.mk

define Package/$(PKG_NAME)
TITLE:=libremesh web user interface based on LUCI
define Package/$(PKG_NAME)/Default
SECTION:=net
CATEGORY:=LiMe
MAINTAINER:=p4u <pau@dabax.net>
URL:=http://libremesh.org
DEPENDS:= +luci-mod-admin-full \
+PACKAGE_lime-proto-bmx6:luci-app-bmx6 +PACKAGE_lime-proto-batadv:luci-app-batman-adv \
endef

define Package/$(PKG_NAME)
$(call Package/$(PKG_NAME)/Default)
TITLE:=libremesh web user interface based on LUCI
MENU:=1
DEPENDS:= +luci-mod-admin-full +lime-system \
+PACKAGE_lime-proto-bmx6:luci-app-bmx6 \
+PACKAGE_lime-proto-batadv:luci-app-batman-adv \
+luci-mod-status +uhttpd +libiwinfo-lua \
+luci-theme-bootstrap +luci-i18n-base-en \
+lime-system
+LIMEWEBUI_ES:luci-i18n-base-es +LIMEWEBUI_PT:luci-i18n-base-pt \
+LIMEWEBUI_DE:luci-i18n-base-de
endef

define Package/$(PKG_NAME)/config
config LIMEWEBUI_ES
bool "Spanish translation support"
depends on PACKAGE_$(PKG_NAME)
default n
help
Spanish translation support for $(PKG_NAME)
config LIMEWEBUI_PT
bool "Portuguese translation support"
depends on PACKAGE_$(PKG_NAME)
default n
help
Portuguese translation support for $(PKG_NAME)
config LIMEWEBUI_DE
bool "Deutsch translation support"
depends on PACKAGE_$(PKG_NAME)
default n
help
Deutsch translation support for $(PKG_NAME)
endef

define Package/$(PKG_NAME)/description
Expand All @@ -46,6 +73,10 @@ define Build/Compile
@find $(PKG_BUILD_DIR)/ -type f -name "*.lua" -exec sed -i '/^--!.*/d' {} \;
endef

ifneq ($(strip $(CONFIG_LIMEWEBUI_ES)),)
TRANSLATIONS+=es
endif

define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/lime
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
Expand All @@ -56,7 +87,7 @@ define Package/$(PKG_NAME)/install
$(CP) $(PKG_BUILD_DIR)/controller/* $(1)/usr/lib/lua/luci/controller/
$(CP) $(PKG_BUILD_DIR)/view/* $(1)/usr/lib/lua/luci/view/lime/
$(CP) $(PKG_BUILD_DIR)/static/* $(1)/www/luci-static/resources/lime/
$(CP) $(PKG_BUILD_DIR)/i18n/* $(1)/usr/lib/lua/luci/i18n/
$(foreach TR, $(TRANSLATIONS), $(CP) $(PKG_BUILD_DIR)/i18n/*.$(TR).lmo $(1)/usr/lib/lua/luci/i18n/ )
endef

$(eval $(call BuildPackage,$(PKG_NAME)))

0 comments on commit cede7b0

Please sign in to comment.