Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 313863

The word "Second" needs translation context

$
0
0

Problem/Motivation

The string "second" in English can mean two different things:
- Unit of time (second, minute, hour)
- Ordinal number (first, second, third).

In some languages, such as German, the word "second" is translated differently depending on which meaning it has -- "Sekunde" for the time unit, and "zweite/r/s" for ordinal number.

In addition to that, ordinal numbers are adjectives, and so in many languages the translation depends on the noun's grammatical gender. For example, in German, you would use "zweiter" (m), "zweite" (f), or "zweites" (n). This also applies to other ordinal numbers (first, third, etc.).

Examples:

  • masculinum: second block - "zweiter Block"
  • femininum: second region - "zweite Region"
  • neutrum: second field - "zweites Feld"

So, when it is used in t() in Drupal, the bare word "Second", as well as other ordinal numbers, need translation context. See
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Language%...
for information about string context (scroll down the page to the section about context).

Currently, there is no translation context for these words in Drupal.

Proposed resolution

Add a context to all uses of the word "Second" in t(), where it might not be clear whether it means a time unit or an ordering, as well as to other ordinal numbers (first, third, etc.) to make it clear what they are ordering (for languages with gender).

For time units, the context string should be something like "time unit" or "datetime".

For ordinal numbers, it needs to be something like "block order", "field order", or similar.

Remaining tasks

  1. Novice task! Identify all applicable occurrences in Drupal core UI text of bare words "First", "Second", "Third", etc. (see note below) [This task can also be done for the other projects that have child issues -- see issue sidebar for a list of child issues]
  2. Decide on the right context string for each occurence
  3. Make a patch to add the strings. Note that for some YML files, the translation context may be added by the POTX process, so a patch of the POTX project may be necessary (see discussion about layout YAML files in comments on this issue).
  4. Do something similar for Drupal 7 and to other projects (in separate issues).

Further notes on task 1

  1. We are looking for the bare word "Second" or "second". For instance, this string does not need context:
    t('Second item')
    

    because it is pretty clear that it means second in order. But t('Second') by itself does need context. Also,

    t('Seconds'),
    

    does not need context, because it is plural and should be the unit of time in this case.

  2. The string can be found in:
    - YAML files
    - t() function calls

User interface changes

The string "Second", and other ordinal numbers, will be properly translatable in all contexts in all languages.

API changes

None.

Data model changes

None.

Release notes snippet


Viewing all articles
Browse latest Browse all 313863

Trending Articles