How to integrate configuring Crowdin Localization for Android MOKO Resources

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


Hi @dilip2882

Are you using Crowdin Github Integration or Github Actions? We recommend using one integration simultaneously, either the native connector or actions, to avoid misconfiguration.

If I got you right, to resolve this, you need to adjust the translation path in your Crowdin GitHub Action configuration to avoid the additional language prefix being added to the entire path.

Something like this should work:

  • source: i18n/src/commonMain/moko-resources/folder1/folder2/strings.xml
  • translation: i18n/src/commonMain/moko-resources/folder1/folder2/%two_letters_code%.%original_file_name%