Skip to content

Commit

Permalink
feat: add translations support (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDiver1975 authored Sep 29, 2022
1 parent 8795d14 commit 73290eb
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ vendor-bin/**/composer.lock
/tests/output/
.phpunit.result.cache
tests/unit/PopTest.php
l10n/.transifexrc
l10n/templates
l10n/*/*.po
l10n/*.pot
l10n/l10n.pl

# SonarCloud scanner
.scannerwork
Expand Down
33 changes: 32 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ app_name=openidconnect
build_dir=$(CURDIR)/build
dist_dir=$(build_dir)/dist
src_files=README.md LICENSE
src_dirs=appinfo img lib vendor
src_dirs=appinfo img l10n lib vendor
all_src=$(src_dirs) $(src_files)

occ=$(CURDIR)/../../occ
Expand Down Expand Up @@ -79,6 +79,7 @@ distdir:
rm -rf $(dist_dir)
mkdir -p $(dist_dir)/$(app_name)
cp -R $(all_src) $(dist_dir)/$(app_name)
rm -Rf $(dist_dir)/$(app_name)/l10n/.tx

.PHONY: sign
sign:
Expand Down Expand Up @@ -175,3 +176,33 @@ vendor-bin/phpstan/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/phpstan

vendor-bin/phpstan/composer.lock: vendor-bin/phpstan/composer.json
@echo phpstan composer.lock is not up to date.


#
# Translation
#--------------------------------------

.PHONY: l10n-push
l10n-push:
cd l10n && tx -d push -s --skip --no-interactive

.PHONY: l10n-pull
l10n-pull:
cd l10n && tx -d pull -a --skip --minimum-perc=75

.PHONY: l10n-clean
l10n-clean:
rm -rf l10n/l10n.pl
find l10n -type f -name \*.po -or -name \*.pot | xargs rm -f
find l10n -type f -name uz.\* -or -name yo.\* -or -name ne.\* -or -name or_IN.\* | xargs git rm -f || true

.PHONY: l10n-read
l10n-read: l10n/l10n.pl
cd l10n && perl l10n.pl $(app_name) read

.PHONY: l10n-write
l10n-write: l10n/l10n.pl
cd l10n && perl l10n.pl $(app_name) write

l10n/l10n.pl:
wget -qO l10n/l10n.pl https://raw.githubusercontent.com/owncloud-ci/transifex/d1c63674d791fe8812216b29da9d8f2f26e7e138/rootfs/usr/bin/l10n
9 changes: 9 additions & 0 deletions l10n/.tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[main]
host = https://www.transifex.com
lang_map = ja_JP: ja

[owncloud.openidconnect]
file_filter = <lang>/openidconnect.po
source_file = templates/openidconnect.pot
source_lang = en
type = PO
6 changes: 6 additions & 0 deletions l10n/de.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
OC.L10N.register(
"openidconnect",
{
"Only guests are allowed through this authentication mechanism" : "Nur Gäste werden durch diesen Authentifizierungsmechanismus zugelassen"
},
"nplurals=2; plural=(n != 1);");
4 changes: 4 additions & 0 deletions l10n/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ "translations": {
"Only guests are allowed through this authentication mechanism" : "Nur Gäste werden durch diesen Authentifizierungsmechanismus zugelassen"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
6 changes: 6 additions & 0 deletions l10n/de_DE.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
OC.L10N.register(
"openidconnect",
{
"Only guests are allowed through this authentication mechanism" : "Nur Gäste werden durch diesen Authentifizierungsmechanismus zugelassen"
},
"nplurals=2; plural=(n != 1);");
4 changes: 4 additions & 0 deletions l10n/de_DE.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ "translations": {
"Only guests are allowed through this authentication mechanism" : "Nur Gäste werden durch diesen Authentifizierungsmechanismus zugelassen"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}

0 comments on commit 73290eb

Please sign in to comment.