Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Intl::tp() doesn't translate plural forms correctly if the singular key is not supplied. #9

Open
Ravenlord opened this issue Apr 21, 2014 · 1 comment
Assignees

Comments

@Ravenlord
Copy link
Member

While Intl::tp() seems to work fine when supplied with a singular key like this:

$this->intl->tp("Movies", "Movie");

It fails to translate correctly when the singular key is omitted:

$this->intl->tp("Movies");

In this case it always returns "Serie" as translation (at least at the moment).

Update: When called with the argument Series it also returns the singular form "Serie" as translation.

Please have a look into this, since this is a really weird behavior.

@Fleshgrinder
Copy link
Member

While it's definitely an interesting error that it returns Serie if you call it with tp("Movies") it's definitely correct that it doesn't work if you only supply the plural form.

How tp() works is described in the comment of the method, but a short summary:

  • If you only supply the plural form, it's assumed that plural and singular are identical (which is the case if you want to translate Series).
  • If you don't supply a count 1 is assumed as count.

So calling tp("Movies") is always wrong, because Movies is only the plural form and not the singular form, you have to call it with tp("Movies", "Movie") in this case.

Also note that the usage of tp() is wrong in the context you were working in, the sidebar. Simply because the word refers to the page and not to the actual count. Therefore it always has to be the plural form. This means that we either call them all with t("Plural") or something like tp("Plural", "Singular", -1). We'd have to use -1 at this point because using any other positive number could result in a singular form in other languages (e.g. Russian).

I'll definitely investigate why it returned Serie when it would have had to return Movies (despite the wrong call).

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

No branches or pull requests

2 participants