Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ArduanovDanil opened this issue May 20, 2024 · 1 comment
Open

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

ArduanovDanil opened this issue May 20, 2024 · 1 comment

Comments

@ArduanovDanil
Copy link

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
Copy link
Member

3y3 commented Jun 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants