Hi,

I couldn't translate a string, so I tracked it down in the code, and found the following line in date_api.module, line 463:
$this->errors[$part] = t("The @part is missing.", array('@part' => $part));

I think this should be better:
$this->errors[$part] = t("The @part is missing.", array('@part' => t($part)));

Thanks,
David

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kardave’s picture

I added a t(), now I can translate separately the 'year' 'month', 'day' strings. Patch attached.

kardave’s picture

Status: Active » Needs review

Oops, forgot to change status to needs review.

Status: Needs review » Needs work

The last submitted patch, date-1844092-date_api-i18n.patch, failed testing.

dboulet’s picture

Version: 7.x-2.6 » 7.x-2.x-dev
Status: Needs work » Needs review
FileSize
547 bytes

I ran into this problem as well. Here is the same patch as in #1, but reformatted.

dboulet’s picture

I’m wondering now if we should output a different, specific message for each possible value for $part. Having one generic error message for all values makes translation hard.

For example, the French translation for the error is:

“Il manque le @part”

The resulting text makes sense when, for example, $part = 'day':

“Il manque le jour”

It doesn’t make sense for other options though. For example, the correct translation would be the following when the part is “year”:

“Il manque l’année”

or for “minute”:

“Il manque la minute”

Il try submitting a new patch as a second option.

dboulet’s picture

I think that this makes more sense…

Spleshka’s picture

Suppose we can make patch more compact.

berdyshev’s picture

Status: Needs review » Reviewed & tested by the community

looks good for me

Spleshka’s picture

Any updates here? Patch seems to be almost obvious.

cafuego’s picture

Status: Reviewed & tested by the community » Fixed

Applied to 7.x-2.x.

Spleshka’s picture

Nice, thanks a lot! :)

Please, next time do not forget to add a commit's author. This is a common community agreement.

cafuego’s picture

Please, next time do not forget to add a commit's author. This is a common community agreement.

Your name, as well as that of others who worked on the issue, is in the dreditor-generated commit message, as is normal on drupal.org.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.