Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serge plugins #150

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ test_script:
- Build test
- perl -MDevel::Cover t/compile.t
- perl -MDevel::Cover t/engine.t
- perl -MDevel::Cover t/plugins.t
- perl -MDevel::Cover t/util-wrap.t

after_test:
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
on:
# Trigger analysis when pushing in master or pull requests, and when creating
# a pull request.
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

name: Build
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
perl: [ '5.34', '5.32', '5.30', '5.28', '5.26' ]
container:
image: perl:${{ matrix.perl }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install dependencies
run: |
# Install using cpanm
cpanm -n -q --skip-satisfied --installdeps .

- name: Configure code coverage
if: matrix.perl == '5.34'
run: |
# Code coverage setup
cpanm -n -q --skip-satisfied Devel::Cover Devel::Cover::Report::Codecov
cover -delete
perl -MDevel::Cover=+ignore,^local/,^t/ t/compile.t
perl -MDevel::Cover=+ignore,^local/,^t/ t/plugins.t
perl -MDevel::Cover=+ignore,^local/,^t/ t/engine.t

- name: Run build script
run: |
perl Build.PL && ./Build && ./Build test

- name: Run tests
run: |
- perl -MDevel::Cover t/compile.t
- perl -MDevel::Cover t/engine.t
- perl -MDevel::Cover t/plugins.t
- perl -MDevel::Cover t/util-wrap.t

- name: Generate code coverage report
if: matrix.perl == '5.34'
run: |
# Code coverage
cover -report codecovbash

- uses: codecov/codecov-action@v2
if: matrix.perl == '5.34'
with:
files: ./cover_db/codecov.json
fail_ci_if_error: true
verbose: true
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ script:
- cover -delete
- perl -MDevel::Cover t/compile.t
- perl -MDevel::Cover t/engine.t
- perl -MDevel::Cover t/plugins.t
- perl -MDevel::Cover t/util-wrap.t
after_success:
- cover -report codecov
Expand Down
21 changes: 21 additions & 0 deletions examples/crowdin/config/sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

"project_id" : "1" # open project page and go to Integrations > API section
"api_token" : "1234567890abcdefghklmnoprstuvxwy" # open profile settings and go to API > New Token > create Token
"base_path" : "./files/resources"
"base_url": "https://api.crowdin.com" # https://{organization-name}.crowdin.com for Crowdin Enterprise

"preserve_hierarchy": false

files: [
{
"source" : "source/*.xliff",

"translation" : "target/%two_letters_code%/%original_file_name%",

"languages_mapping" : {
"two_letters_code" : {
"crowdin_language_code" : "local_name"
}
},
}
]
76 changes: 76 additions & 0 deletions examples/crowdin/sample.serge
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
sync
{
ts
{
plugin crowdin

data
{
config_file ./config/sample.yml
}
}

vcs
{
plugin git

data
{
local_path %ENV:SERGE_DATA_DIR%/my_project
remote_path ssh://l10n@git.example.com/myrepo
name L10N Robot
email l10n-robot@example.com
}
}
}

jobs
{
{
id crowdin.sample.job

source_language en
destination_languages de ja fr-ca source

source_match \.properties$
source_exclude _[a-zA-Z][a-zA-Z]\.properties$

parser
{
plugin parse_properties
}

serializer
{
plugin serialize_xliff
}

db_source DBI:SQLite:dbname=./translate.db3
db_namespace my_project

callback_plugins
{
:source_ts_file_path
{
plugin replace_strings
phase rewrite_absolute_ts_file_path

data
{
if
{
lang_matches ^source$

then
{
replace \/target\/source \/source
}
}
}
}
}

ts_file_path ./files/resources/target/%LOCALE%/%PATH%%NAME%.xliff
output_file_path %ENV:SERGE_DATA_DIR%/my_project/%PATH%%NAME%_%LOCALE%.%EXT%
}
}
57 changes: 57 additions & 0 deletions examples/lingohub/sample.serge
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
sync
{
ts
{
plugin lingohub

data
{
project Sample
root_directory ./files
resource_directory resources
target_languages de es fr-ca
}
}

vcs
{
plugin git

data
{
local_path %ENV:SERGE_DATA_DIR%/my_project
remote_path ssh://l10n@git.example.com/myrepo
name L10N Robot
email l10n-robot@example.com
}
}
}

jobs
{
{
id lingohub.sample.job

source_language en
destination_languages de ja fr-ca

source_match \.properties$
source_exclude _[a-zA-Z][a-zA-Z]\.properties$

parser
{
plugin parse_properties
}

serializer
{
plugin serialize_xliff
}

db_source DBI:SQLite:dbname=./translate.db3
db_namespace my_project

ts_file_path ./files/resources/%LOCALE%/%PATH%%NAME%.xliff
output_file_path %ENV:SERGE_DATA_DIR%/my_project/%PATH%%NAME%_%LOCALE%.%EXT%
}
}
2 changes: 2 additions & 0 deletions examples/locize/config/sample.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
apiKey = my-api-key-d9de-4f55-9855-a9ef0ed44672
projectId = my-project-id-93e1-442a-ab35-24331fa294ba
56 changes: 56 additions & 0 deletions examples/locize/sample.serge
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
sync
{
ts
{
plugin locize

data
{
config_file ./config/sample.cfg
path ./files/resources
format xliff12
}
}

vcs
{
plugin git

data
{
local_path %ENV:SERGE_DATA_DIR%/my_project
remote_path ssh://l10n@git.example.com/myrepo
name L10N Robot
email l10n-robot@example.com
}
}
}

jobs
{
{
id locize.sample.job

source_language en
destination_languages de ja fr-ca

source_match \.properties$
source_exclude _[a-zA-Z][a-zA-Z]\.properties$

parser
{
plugin parse_properties
}

serializer
{
plugin serialize_xliff
}

db_source DBI:SQLite:dbname=./translate.db3
db_namespace my_project

ts_file_path ./files/resources/%LOCALE%/%PATH%%NAME%.xliff
output_file_path %ENV:SERGE_DATA_DIR%/my_project/%PATH%%NAME%_%LOCALE%.%EXT%
}
}
2 changes: 2 additions & 0 deletions examples/lokalise/config/sample.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
token : a12345a12345a12345a12345a12345a12345a123
project-id : 373182575d64e892ba8ab2.58226357
56 changes: 56 additions & 0 deletions examples/lokalise/sample.serge
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
sync
{
ts
{
plugin lokalise

data
{
config_file ./config/sample.cfg
resource_directory ./files/resources
languages de es fr-ca
}
}

vcs
{
plugin git

data
{
local_path %ENV:SERGE_DATA_DIR%/my_project
remote_path ssh://l10n@git.example.com/myrepo
name L10N Robot
email l10n-robot@example.com
}
}
}

jobs
{
{
id lokalise.sample.job

source_language en
destination_languages de ja fr-ca

source_match \.properties$
source_exclude _[a-zA-Z][a-zA-Z]\.properties$

parser
{
plugin parse_properties
}

serializer
{
plugin serialize_xliff
}

db_source DBI:SQLite:dbname=./translate.db3
db_namespace my_project

ts_file_path ./files/resources/%LOCALE%/%PATH%%NAME%.xliff
output_file_path %ENV:SERGE_DATA_DIR%/my_project/%PATH%%NAME%_%LOCALE%.%EXT%
}
}
5 changes: 5 additions & 0 deletions examples/mojito/config/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
l10n.resttemplate.host=localhost
l10n.resttemplate.port=8080
l10n.resttemplate.authentication.credentialProvider=CONFIG
l10n.resttemplate.authentication.username=adminuser
l10n.resttemplate.authentication.password=testpwd
Loading