added l10n

This commit is contained in:
JanAckermann
2021-03-24 09:56:10 +01:00
parent bbcea23e85
commit 35463646e4
7 changed files with 103 additions and 1 deletions

3
.gitignore vendored
View File

@@ -25,3 +25,6 @@ vendor-bin/**/composer.lock
# drone CI is in .drone.star, do not let someone accidentally commit a local .drone.yml
.drone.yml
**/l10n/locale
**/l10n/template.pot

49
.make/l10n.mk Normal file
View File

@@ -0,0 +1,49 @@
# On OSX the PATH variable isn't exported unless "SHELL" is also set, see: http://stackoverflow.com/a/25506676
SHELL = /bin/bash
NODE_BINDIR = ./node_modules/.bin
export PATH := $(NODE_BINDIR):$(PATH)
INPUT_FILES = ./ui
# Where to write the files generated by this makefile.
OUTPUT_DIR = ./l10n
# Template file
TEMPLATE_FILE = ./l10n/template.pot
# Name of the generated .po files for each available locale.
LOCALE_FILES = $(shell find l10n/locale -name '*.po')
.PHONY: l10n-push
l10n-push:
cd $(OUTPUT_DIR) && tx -d push -s --skip --no-interactive
.PHONY: l10n-pull
l10n-pull:
cd $(OUTPUT_DIR) && tx -d pull -a --skip --minimum-perc=75
.PHONY: l10n-clean
l10n-clean:
rm -rf $(OUTPUT_DIR)/locale
rm -rf $(OUTPUT_DIR)/translations.json
rm -f $(TEMPLATE_FILE)
.PHONY: l10n-read
l10n-read: node_modules $(TEMPLATE_FILE)
.PHONY: l10n-write
l10n-write: node_modules $(OUTPUT_DIR)/translations.json
# Create a main .pot template, then generate .po files for each available language.
# Thanks to Systematic: https://github.com/Polyconseil/systematic/blob/866d5a/mk/main.mk#L167-L183
$(TEMPLATE_FILE):
# Extract gettext strings from each template file and create a POT dictionary template.
# Generate .po files for each available language.
export GETTEXT_SOURCES=`find $(INPUT_FILES) -name '*.vue' -o -name '*.js'`; \
node ./node_modules/easygettext/src/extract-cli.js --attribute v-translate --output $(OUTPUT_DIR)/template.pot $$GETTEXT_SOURCES;
# Generate translations.json file from .pot template.
$(OUTPUT_DIR)/translations.json:
gettext-compile --output $(OUTPUT_DIR)/translations.json $(LOCALE_FILES);

View File

@@ -12,6 +12,8 @@ WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
L10N_MODULES := $(shell find . -path '*.tx*' -name 'config' | sed 's|/[^/]*$$||' | sed 's|/[^/]*$$||' | sed 's|/[^/]*$$||')
# if you add a module here please also add it to the .drone.star file
OCIS_MODULES = \
accounts \
@@ -153,3 +155,28 @@ ifndef CHANGELOG_VERSION
$(error CHANGELOG_VERSION is undefined)
endif
$(CALENS) --version $(CHANGELOG_VERSION) -o ocis/dist/CHANGELOG.md
.PHONY: l10n-pull
l10n-pull:
@for extension in $(L10N_MODULES); do \
make -C $$extension l10n-pull; \
done
.PHONY: l10n-clean
l10n-clean:
@for extension in $(L10N_MODULES); do \
make -C $$extension l10n-clean; \
done
.PHONY: l10n-read
l10n-read:
@for extension in $(L10N_MODULES); do \
make -C $$extension l10n-read; \
done
.PHONY: l10n-write
l10n-write:
@for extension in $(L10N_MODULES); do \
make -C $$extension l10n-write; \
done

View File

@@ -20,6 +20,9 @@ include ../.make/release.mk
############ docs generate ############
include ../.make/docs.mk
############ l10n ############
include ../.make/l10n.mk
.PHONY: docs-generate
docs-generate: config-docs-generate \
grpc-docs-generate

9
accounts/l10n/.tx/config Normal file
View File

@@ -0,0 +1,9 @@
[main]
host = https://www.transifex.com
[owncloud.ocis-accounts]
file_filter = locale/<lang>/LC_MESSAGES/app.po
minimum_perc = 0
source_file = template.pot
source_lang = en
type = PO

View File

@@ -15,13 +15,15 @@ endif
include ../.make/go.mk
############ release ############
include ../.make/release.mk
############ docs generate ############
include ../.make/docs.mk
############ l10n ############
include ../.make/l10n.mk
.PHONY: docs-generate
docs-generate: config-docs-generate \
grpc-docs-generate

9
settings/l10n/.tx/config Normal file
View File

@@ -0,0 +1,9 @@
[main]
host = https://www.transifex.com
[owncloud.ocis-settings]
file_filter = locale/<lang>/LC_MESSAGES/app.po
minimum_perc = 0
source_file = template.pot
source_lang = en
type = PO