YAML - Style & Path Exclusion

Hello, all my translation files are in YAML and I was wondering how I can do the following:

  1. How do I ignore/exclude certain YAML entries from showing up in the translation UI? Not the file paths, but literal YAML entries. I have more than 100 translatable files and most of these files contain certain information that shouldn’t be translated at all.
    For example:
  hello: "Hi hello"
  at: 10

The number shouldn’t be translated, it’s a number after all. And type is a system defined string that shouldn’t be translated either. So I would like to exclude “test.at” and “test.type” paths from being translated. I cannot separate these into a configuration file that is not meant for translation, since it’ll be extremely hard for end-users to identify and edit these values when they’re not in the same location.

  1. The translation pull request changes the default YAML style that the source file uses. This is a problem, because YAML sequence nodes that are just a list of numbers, use the block style instead of the flow style which makes the file uglier and unnecessarily longer. This seems to only happen to sequence nodes. Normal scalar nodes like strings, preserve their style (single/double quoted, literal and folded.) An example can be found here. This second issue is really not that important if I can solve the first one, because it’s just a list of numbers and shouldn’t be translated.

Thank you for your time!

Hello @CryptoMorin

You may find these applications helpful:

Discover the right solution to enhance Crowdin experience → allows you to configure .json and .yaml files

Discover the right solution to enhance Crowdin experience → allows you to hide some strings based on the rule you add

Discover the right solution to enhance Crowdin experience → sample file + details of the format (just in case it’s needed)

We rebuild the file during the import/export, so some styles (usually, it’s spaces for example) may be changed. But we always export a valid file that can be used afterward.

Can you give a try the additional tools I’ve shared with you in order to confirm whether they worked for your case?

Thanks for the reply. The File Import Tweak app seems to be exactly what I’m looking for, but it looks like the files need to be somehow re-imported for the rule to apply.

Rules are applied to new or updated keys in your resource file in the order they are listed. If a key matches multiple rules, all matching rules are applied.

Only new or updated keys are affected by rules during a file update.

I’m not sure what a “file update” exactly means here, but I tried translating a single entry and saving, nothing changed. I Also tried removing the language from Settings > Languages and adding it back from there, but the rule is still not working. (And just to clarify, yes, I did click on the submit button before re-adding the language and checked “hidden” file filter)

This is the project in case you want to take a look for yourself.

Hi @CryptoMorin

To update the source files, you can do, for example, Pause Sync for the connected branch of your GitHub integration → then go to the Sources tab and delete the branch with the source files or only individual source files for which the import rule should be applied → return to the GitHub integration page and do Resume of the connected branch

You can not worry about translations that have already been made, all translations are stored in TM (Translation Memory), so for new (updated) files you can easily start Pre-Translation via TM so that they become translated again

Or update the files in your repo on the GitHub side by adding new strings to them or changing some keys so that during synchronization the system sees the changes and the files are updated in the project in Crowdin

How do you think will it work for you?

Hello @Roman, thanks it’s working now! There is just one small issue. The RegEx for matching the files seem to only match against the file name itself and not the entire path including the folders. I believe this is not possible right now? It’d be really nice to have this feature.

Hello @CryptoMorin

We have other applications, like this one, for example, Regex Content Processor which can modify the file name.

Modifying the full file path can be a hard one because it’s hard to predict the file origin and folder sequence.

I think there’s been a misunderstanding. I don’t want to rename/delete any files or replace anything in the files. The File Import Tweak app is what I need, but there’s a problem with the file filter regex that it accepts. The regex that you input for the file filters is only matched against the file name and not the full path. For example, if my file is in /master/core/src/main/resources/guis/item-editor/attributes/something.yml the regex is matched against something.yml string only. I.e. I cannot apply rules to files based on their folder. I.e. If I were to use .*guis.* the regex will not match and the rule will not be applied to something.yml

But that app is actually pretty useful too since I have custom YAML syntax in some files that I can remove. Thanks for mentioning it.

Hello, @CryptoMorin

I just talked to the developer. Right now the app doesn’t have a file path in its scope, so we won’t be able to easily/quickly allow filtering by file path.

Please let us know if this feature is critical for you, it will help us prioritize future development.

It’s not critical as I’m able to achieve what I’m looking for by using negative lookaheads/lookbehinds regex for now, but I’ll be using it in the future because different folders can have files with the same names.

Thank you for taking your time to check this for me and considering it. I’m sure someone else will find this feature helpful too!

1 Like

Thanks for your feedback! We always strive to make our platform better and I’m sure one day this feature will be brought to life.