-
Couldn't load subscription status.
- Fork 186
[i18n] Dashboard -- My Tasks #9750
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
Conversation
| msgstr "問題トラッカー" | ||
|
|
||
|
|
||
| # Google Translate is giving me completely different translations for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this is your answer
No, not all languages have a clear and consistent distinction between singular and plural forms. While many languages, like English, have distinct singular and plural forms for nouns, some languages, such as Japanese and Chinese, rely on context to indicate whether a noun refers to one or multiple entities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's the source of my confusion. It should be the same and "問題" is, but the machine translation of the "Your assigned" part is completely different based on if "issues" is singular or plural in the original English.
| */ | ||
| public function __construct( | ||
| \User $user, | ||
| string $labeldomain, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neither @ridz1208 nor I like this. One proposed change is passing something like:
class TranslatableString {
function __construct(public readonly string $singular, public readonly string $plural, public readonly string $textdomain) {}
public function getPlural(int $n) : string { return dngettext($this->textdomain, $this->singular, $this->plural, $n); }
public function __toString() : string { return dgettext($this->textdomain, $this->singular); }
}
instead of many parameters.
This updates the "My Tasks" to handle plurals with gettext, rather than hardcoding adding an "s" in the code. Translations are added for existing "My Tasks" widgets at the same time.
b73636c to
68946fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This builds on aces#9747 to add support for translating the "My Tasks" widgets on the LORIS dashboard. In the current code, an "s" is hardcoded to be added when count > 1, which doesn't work for other languages. The signature had to be updated to include a singular and plural label, as well as the text domain that the labels come from, since they come from the module providing the widget and not the dashboard. (The dngettext call also could not be done in the module, because the module doesn't have the count to know if it's plural.)

This builds on #9747 to add support for translating the "My Tasks" widgets on the LORIS dashboard. In the current code, an "s" is hardcoded to be added when count > 1, which doesn't work for other languages.
The signature had to be updated to include a singular and plural label, as well as the text domain that the labels come from, since they come from the module providing the widget and not the dashboard. (The dngettext call also could not be done in the module, because the module doesn't have the count to know if it's plural.)