Problem/Motivation
There is the string 'Weight' used in two different context in Drupal;
- Used as "Ordering indicator" in sortable Tables, Node, etc.
- Used as "Measuring quantities" in e-cart's shopping system.
In Chinese, and other languages, different translations are required for each.
Proposed resolution
- Add a context to the string.
Comment | File | Size | Author |
---|---|---|---|
#5 | 2173917-weight.patch | 9.99 KB | droplet |
Comments
Comment #2
droplet CreditAttribution: droplet commentedweight.patch queued for re-testing.
Comment #3
YesCT CreditAttribution: YesCT commentedadding d8mi, not sure if other tag for language...
Comment #4
dawehner+1 for more contexts. This really helps confusions like
Note: It should be t('Weight', array(), array('context' => 'Ordering')); instead, see \Drupal\Core\StringTranslation\TranslationInterface::translate(). In general it feels odd that the context is uppercase
Comment #5
droplet CreditAttribution: droplet commentedahh right! Fixed the context array
Comment #6
dawehner@droplet
Do you have an explanation regarding the uppercase-ness?
Comment #7
Sutharsan CreditAttribution: Sutharsan commentedWhy do we add a string context to the dominating usage of the word 'Weight'? This wil result in the maximum number of strings requiring a context. Guidelines for contexts are being discussed in #1035716: [policy, no patch] Decide and document guidelines for using string context. One of the criteria says:
Therefore, the context should not be added to 'Weight' in the meaning as sort order, but in strings that use 'Weight' for mass.
Putting the status to 'needs work', but would actually vote for won't fix.
Comment #8
droplet CreditAttribution: droplet commentedwhile the issue spending 3 years on discussion, I think it should not let that blocking any other issues. We need a properly way to sort the REAL problem temporarily, not just write the rules on paper and waiting for years and years and no changes. Do you agree?
Comment #9
Sutharsan CreditAttribution: Sutharsan commentedIf you mean with a temporary solution, to commit this patch? I don't agree. There is no temporary solution with contexts. Once a context is in, we can never take it out. Nowadays even Drupal 5 translations are still in use, so it can be expected that contexts which are added today will be in use for many years to come. In php code we can break with the past, but in translations we (currently) can't.
The fact that the discussion on string context guidelines does not progress, should not block this issue. I proposed to add a context to those cases that use weight in the meaning of mass and not, as in #5 add the context to weight in the meaning of sort order.
Comment #10
Sutharsan CreditAttribution: Sutharsan commenteddroplet said in https://drupal.org/comment/8526233#comment-8526233:
It is not relevant which words other systems use for sort order, Drupal string are only shared within Drupal. Drupal core uses "Weight" at least 53 times in translatable strings. Can you show me where the problem is? Where is the translation conflict that this context will solve?
53 translatable strings with 'weight' :
git grep -i "[ |>]\t('[^']*weight"