Conversation
| // either use toLocaleString() | ||
| // (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString) | ||
| // or use the "globalize" JS library which can also parse the localized string back | ||
| // (https://github.com/globalizejs/globalize#number-module) |
| // constants need to be marked for translation with N_() and translated with _() later | ||
| const SIZE_OPTION_LABELS = Object.freeze({ | ||
| // TRANSLATORS: radio button label, fully automatically computed partition size, no user input | ||
| auto: N_("Auto"), |
There was a problem hiding this comment.
Question: why N_ instead of _ ?
There was a problem hiding this comment.
That constant is evaluated too early, at that point the cockpit.language is not initialized yet and the text would not be translated.
There was a problem hiding this comment.
Ahh, thanks for the explanation.
There was a problem hiding this comment.
Hi guys!
Yesterday I found this looking more information about N_ when reviewing ancorgs's PR. I know that N_ is used to mark for translation, but I do not understand why it is needed either, here and in the @ancorgs's PR linked above.
Also, I wonder if, in case of really needed, this will change with the new architecture.
There was a problem hiding this comment.
The N_ macro/function used for translating constants, it does not depend on the architecture or programming language (you can use use it even in C or C++ code).
The problem is that
Object.freeze({
auto: _("Auto"),
...
would translate the value using the language configured at the initialization, it would not retranslate the text after changing the language later at runtime.
https://yastgithubio.readthedocs.io/en/latest/localization/#translating-constants
InstallButton.jsxfile to use square brackets - it looks better and it is more compatible with the Markdown format (it is cheap to do it now, we do not have translations yet)