How to make yaml keys translatable?

Hello,

we have a YAML file used as index to build the documentation. The original file looks like https://github .com/appium/appium/blob/master/packages/appium/docs/mkdocs-en.yml
where entries under nav: reflect the actual documents hierarchy and should be translated. Although, Crowdin only shows leaf entries as translatable, so, for example, from the below hierarchy

nav:
  - Welcome: index.md
  - Blog: blog/index.md
  - Introduction:
      - intro/index.md
      - Background:
          - intro/appium.md

only entries like index.md, blog/index.md, intro/index.md and intro/appium.md are translatable, while I would want Welcome, Blog, Introduction and Background entries to be translatable as well.

Is there a way to make it possible? Currently files are being added to storage with Content-Type set to application/yaml

Hi appium

I will review this and confirm if it is achievable :slightly_smiling_face:

1 Like

YAML format always has this structure:

key: value

In your sample, we should translate exactly the key of the string (e.g. Welcome) which has a value like index.md

The “Custom File Format” app and its GPT couldn’t manage to generate a working script for me :grimacing:

What do you think of uploading this file as .txt to Crowdin? It’s possible:

You can add the following to the configuration file:

source: /packages/appium/docs/mkdocs-en.yml
translation: /packages/appium/docs/mkdocs-%two_letters_code%.yml
dest: /packages/appium/docs/mkdocs-en.txt
type: txt

In this case, you will see it this way in the editor (strings with .md file names can be hidden)

Thanks for the advice @Andrulko

I am probably too stupid to deal with the yaml config, and was not able to understand from the linked document where exactly it is supposed to be applied.
Instead I’ve just modified the CI script (https://github .com/appium/appium/pull/20822), so now it uploads the file as a plain text and then maps it back to yaml format while doing the export.

There is a potential risk translators may corrupt the resulting yaml file, by, for example, skipping some mandatory formatting characters. In the worst case I might consider doing the basic yaml validation upon export from Crowdin in my script.