Skip to content

Commit

Permalink
Merge pull request #15 from Bartlebyy/add_new_options_for_translations
Browse files Browse the repository at this point in the history
Add more options for upload translations
  • Loading branch information
VBeytok authored May 13, 2020
2 parents 84d461d + c2f9500 commit e8b141e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,22 @@ In case you don’t want to download translations from Crowdin (`download_transl
# upload options
upload_sources: true
upload_translations: true
auto_approve_imported: true
import_eq_suggestions: true
import_duplicates: true
# download options
download_translations: true
language: 'uk'
push_translations: true
# This is the name of the git branch that Crowdin will create when opening a pull request.
# This is the name of the git branch that Crowdin will create when opening a pull request.
# This branch does NOT need to be manually created. It will be created automatically by the action.
localization_branch_name: l10n_crowdin_action
create_pull_request: true
# global options
# This is the name of the top-level directory that Crowdin will use for files.
# Note that this is not a "branch" in the git sense, but more like a top-level directory in your Crowdin project.
# This branch does NOT need to be manually created. It will be created automatically by the action.
Expand All @@ -76,10 +79,10 @@ In case you don’t want to download translations from Crowdin (`download_transl
dryrun_action: true
# config options
# This is a numeric id, not to be confused with Crowdin API v1 "project identifier" string
# See "API v2" on https://crowdin.com/project/<your-project>/settings#api
project_id: ${{ secrets.CROWDIN_PROJECT_ID }}
project_id: ${{ secrets.CROWDIN_PROJECT_ID }}
# A personal access token, not to be confused with Crowdin API v1 "API key"
# See https://crowdin.com/settings#api-key to generate a token
Expand Down
12 changes: 12 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ inputs:
description: 'Upload translations to Crowdin'
default: 'false'
required: false
auto_approve_imported:
description: 'Automatically approves uploaded translations'
default: 'false'
required: false
import_eq_suggestions:
description: 'Defines whether to add translation if it is equal to source string in Crowdin project'
default: 'false'
required: false
import_duplicates:
description: 'Defines whether to add translation if there is the same translation already existing in Crowdin project'
default: 'false'
required: false

# download options
download_translations:
Expand Down
12 changes: 12 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ upload_sources() {
}

upload_translations() {
if [[ "$INPUT_AUTO_APPROVE_IMPORTED" = true ]]; then
OPTIONS="${OPTIONS} --auto-approve-imported"
fi

if [[ "$INPUT_IMPORT_EQ_SUGGESTIONS" = true ]]; then
OPTIONS="${OPTIONS} --import-eq-suggestions"
fi

if [[ "$INPUT_IMPORT_DUPLICATES" = true ]]; then
OPTIONS="${OPTIONS} --import-duplicates"
fi

echo "UPLOAD TRANSLATIONS";
crowdin upload translations ${CONFIG_OPTIONS} ${OPTIONS};
}
Expand Down

0 comments on commit e8b141e

Please sign in to comment.