I’m integrating Crowdin with my Android project that uses MOKO Resources for localization. I’ve encountered an issue where Crowdin is creating an incorrect directory structure when downloading translations.
Instead of placing the translated files in: i18n/src/commonMain/moko-resources/fr/strings.xml
Crowdin is creating: fr/i18n/src/commonMain/moko-resources/fr/strings.xml
It appears to be adding a language prefix to the entire directory path rather than just using the language code in the specified location.
My current configuration is:
- Source files path:
i18n/src/commonMain/moko-resources/base/strings.xml
- Translated files path:
i18n/src/commonMain/moko-resources/%two_letters_code%/strings.xml
I’m using the Crowdin GitHub Action with the following configuration:
yaml
config: |
files:
- source: i18n/src/commonMain/moko-resources/base/strings.xml
translation: i18n/src/commonMain/moko-resources/%two_letters_code%/strings.xml
How can I prevent Crowdin from adding the language prefix to the entire path? I need the translations to go directly to the proper MOKO resources directory structure as specified in my translation path.
name: Crowdin Action
'on':
push:
branches:
- main
jobs:
synchronize-with-crowdin:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: crowdin action
uses: crowdin/github-action@v2
with:
upload_sources: 1
upload_translations:
download_translations: 1
localization_branch_name: l10n_crowdin_translations
create_pull_request: 1
pull_request_title: PropertyManager Crowdin Translations
pull_request_body: 'PropertyManager Crowdin translations by [Crowdin GH Action](https://github.com/crowdin/github-action)'
pull_request_base_branch_name: main
config: |-
files:
- source: i18n/src/commonMain/moko-resources/*/strings.xml
tra translation: i18n/src/commonMain/moko-resources/%two_letters_code%/strings.xml
env:
GITHUB_TOKEN: '${{ secrets.GH_TOKEN }}'
CROWDIN_PROJECT_ID: '${{ secrets.CROWDIN_PROJECT_ID }}'
CROWDIN_PERSONAL_TOKEN: '${{ secrets.CROWDIN_PERSONAL_TOKEN }}'
files:
- source: i18n/src/commonMain/moko-resources/base/strings.xml
translation: i18n/src/commonMain/moko-resources/%two_letters_code%/strings.xml