diplodoc-platform / translation

generate xlf and skeleton for translation and assemble markdown out of xlf and skeleton
MIT License
7 stars 3 forks source link

Is it possible to add blocks of code to translating? #147

Open ArduanovDanil opened 4 months ago

ArduanovDanil commented 4 months ago

Blocks of code often contain comments. Can I add them for translation?

Example of .md below and in attached file:

Each - applying the same rules for each data item in the set

The Each rule allows the same rules to be applied to each data item in the set. The following example shows the configuration for validating RGB color components:

use Yiisoft\Validator\Rule\Each;
use Yiisoft\Validator\Rule\Integer;

new Each([
    new Integer(min: 0, max: 255),
]);

By combining with another built-in rule called Count we can be sure that the number of components is exactly 3:

use Yiisoft\Validator\Rule\Count;
use Yiisoft\Validator\Rule\Each;
use Yiisoft\Validator\Rule\Integer;

$rules = [
    // Applies to a whole set.
    new Count(3),
    // Applies to individual set items.
    new Each(        
        // For single rules, wrapping with array / iterable is not necessary.
        new Integer(min: 0, max: 255),
    ),
];

For more information about using it with Nested, see the Nested guide.

3y3 commented 3 months ago

This is possible. There was extension point for precise code blocks translation https://github.com/diplodoc-platform/translation/blob/master/src/skeleton/rules/code.ts#L26

You are welcome to add PR with your preferred languages