- Issue created by @tsotoodeh
- 🇧🇬Bulgaria yivanov
The units of time are wrapped in a t() function, which means they are available to be translated in the UI Translate interface.
- 🇻🇳Vietnam tra.duong
@yivanov
`tsotoodeh` see an error, he may not explained it clear.
You can install a fresh Drupal site. Enable languages and interface translation, config translations..etc to check.
You won't see the options in the 'Unit of time' which is `tsotoodeh` mentioned.
If you search for- @minute
- @second
- @custom
- @default
You will see the translation string of them. You can see `@minute` but cannot see `Only Minute`.
These are arguments as the code as this line provide:$this->t('@minute', ['@minute' => 'Only Minute']);
So, if you translate the string by arguments, it may only available for developers or someone can read the code. It is not translate the text, just a replacement argument.
There are 2 options to improve/correct this translations:
// Your code: $only_minute = $this->t('@minute', ['@minute' => 'Only Minute']); $minute_second = $this->t('@second', ['@second' => 'Minute and Second']); $below = $this->t('@custom', ['@custom' => 'Minute and Second, 1 minute if words < words per minute']); $default = $this->t('@default', ['@default' => 'Default (only minute) without text']); /* Option 1:*/ $only_minute = $this->t('Only Minute'); $minute_second = $this->t('Minute and Second'); $below = $this->t('Minute and Second, 1 minute if words < words per minute'); $default = $this->t('Default (only minute) without text'); /* Option 2:*/ $only_minute = $this->t('@minute', ['@minute' => $this->t('Only Minute')]); $minute_second = $this->t('@second', ['@second' => $this->t('Minute and Second')]); $below = $this->t('@custom', ['@custom' => $this->t('Minute and Second, 1 minute if words < words per minute')]); $default = $this->t('@default', ['@default' => $this->t('Default (only minute) without text')]);
Option 1: will provide 1 string in the translation text.
Option 2: will provide 2 strings (ex: `@minute` and `Only Minute`).Note
I think `tsotoodeh` mentioned about Option1 and this Option1 is correct.
Besides, the @minute, @second ... may cause conflicts on translation string. They are so popular. - 🇮🇷Iran tsotoodeh
@tra.duong
I confirm your clarification 'tra.duong'. Both options mentioned does not convey the correct meaning and functionality that the module presents. And yes the context strings has popular use cases which makes it not possible to translate it in other forms. Are we clear 'yivanov'? Thank you. - Status changed to Needs review
almost 2 years ago 3:59am 14 February 2023 - 🇻🇳Vietnam tra.duong
I made a commit on 3341137-make-the-settings
Please review. - eb19abbc committed on 8.x-1.x
git commit -m 'Issue #3341137 by tra.duong, tsotoodeh: Make the settings...
- eb19abbc committed on 8.x-1.x
- Status changed to Fixed
over 1 year ago 7:20am 11 March 2023 Automatically closed - issue fixed for 2 weeks with no activity.