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

Dispatcher: preserve profile name, show actions count #9682

Merged
merged 3 commits into from
Oct 27, 2022

Conversation

hius07
Copy link
Member

@hius07 hius07 commented Oct 25, 2022

(1) Preserve profile name when selecting the "Nothing" action.
(2) Show number of actions instead of "Many".

TODO after #9651 (comment): fix checkbox of the "Nothing" action for profiles with name.

checked_func = function()
return location[settings] ~= nil and next(location[settings]) == nil
end,


This change is Reviewable

frontend/dispatcher.lua Show resolved Hide resolved
@yparitcher
Copy link
Member

Added

@Frenzie Frenzie added this to the 2022.11 milestone Oct 25, 2022
if count == 1 then
local item = next(settings)
if item == "settings" then item = next(settings, item) end
action_name = Dispatcher:getNameFromItem(item, settings)
else
action_name = _("Many")
action_name = T(_("%1 actions"), count)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if this is already in a > 1 branch ? Put something anyway for the singular form for translators to translate even if not used ? Put an empty string ?
And how do we now how many plural form to put here, as its a property of the language. Or do we just use it with 2 items (as the doc says, ngettext (msgid, msgid_plural, n) ), and it's the translation tools that will propose and record the 5 plural variations of Tadjugizbekistanese ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if this is already in a > 1 branch ?

That's my entire point. In some languages you have 3many vs 5many vs 10many vs 100many.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And how do we now how many plural form to put here, as its a property of the language. Or do we just use it with 2 items (as the doc says, ngettext (msgid, msgid_plural, n) ), and it's the translation tools that will propose and record the 5 plural variations of Tadjugizbekistanese ?

Yes, that's what it's for. English (as well as Dutch, French, etc.) basically only have 1 or plural.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put something anyway for the singular form for translators to translate even if not used ? Put an empty string ?

Probably empty.

Copy link
Member

@Frenzie Frenzie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some languages have different kinds of many. ;-)

@hius07
Copy link
Member Author

hius07 commented Oct 27, 2022

action_name = T(N_("", "%1 actions", count), count)

Is it okay? Can be merged?

@Frenzie
Copy link
Member

Frenzie commented Oct 27, 2022

Yes, that seems fine by me.

@Frenzie Frenzie merged commit d37803a into koreader:master Oct 27, 2022
@hius07 hius07 deleted the Dispatcher-preserve-name branch October 27, 2022 12:40
Frenzie added a commit to Frenzie/koreader that referenced this pull request Nov 1, 2022
Should fix koreader#9719

Regression introduced in koreader#9682 by my fault.

See the xgettext error message:

```
frontend/dispatcher.lua:573: warning: Empty msgid.  It is reserved by GNU gettext:
                                      gettext("") returns the header entry with
                                      meta information, not the empty string.
xgettext: warning: msgid '' is used without plural and with plural.
                   xgettext.c:1975: Here is the occurrence without plural.
                   frontend/dispatcher.lua:573: Here is the occurrence with plural.
                   Workaround: If the msgid is a sentence, change the wording of the sentence; otherwise, use contexts for disambiguation.
```
Frenzie added a commit that referenced this pull request Nov 1, 2022
Should fix #9719

Regression introduced in #9682 by my fault.

See the xgettext error message:

```
frontend/dispatcher.lua:573: warning: Empty msgid.  It is reserved by GNU gettext:
                                      gettext("") returns the header entry with
                                      meta information, not the empty string.
xgettext: warning: msgid '' is used without plural and with plural.
                   xgettext.c:1975: Here is the occurrence without plural.
                   frontend/dispatcher.lua:573: Here is the occurrence with plural.
                   Workaround: If the msgid is a sentence, change the wording of the sentence; otherwise, use contexts for disambiguation.
```

Co-authored-by: Frans de Jonge <frans@clevercast.com>
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

Successfully merging this pull request may close these issues.

4 participants