Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
In #2031885: Add t() context to "Order" string. there was added language context for "Order" word used in sorting context, meantime views got no change
Proposed resolution
Add context to views usage
Remaining tasks
decide on test and commit
User interface changes
no
API changes
no
Data model changes
no
Release notes snippet
no
Original report by @Kartagis
We have languages in which a word could have different meanings. One of those languages is Turkish, which is my native language. One particular example I could give is this word, which could mean either sıra, sipariş depending on whether it's coming from Core or Commerce. Order is listed under both Core and Commerce. So, there needs to be a more grained context differentiation system.
Comment | File | Size | Author |
---|---|---|---|
#3 | 3064523-3.patch | 720 bytes | andypost |
Comments
Comment #2
andypostIt's hard to guess which words require contexts, so better to manage it on per word basis
EDIT Like #2965786: Translation of "Checked" as used on the Status page needs context
Comment #3
andypostSo there's just views to fix
Comment #4
andypostComment #5
andypostComment #6
KartagisBy the way, it's not only Order. We need a more grained context specification for any word.
Comment #8
Sutharsan CreditAttribution: Sutharsan at LimoenGroen commentedThe result of
git grep -F "'Order'"
is still the same in 8.9.x as in #3.As far as I has searched, only one translation of Order needs to be fixed. That is what his patch does.
Comment #9
KartagisAnother pair just came to my mind. State may mean Eyalet or Durum depending on whether it's Commerce or Core, respectively.
Comment #10
Sutharsan CreditAttribution: Sutharsan at LimoenGroen commented@Kartagis, If you think this should be fixed, than create a new issue for it.
Personally I don't think core should fix every translation context that occurs with contrib modules. This issue makes existing contexts applied consistently. Consider creating an issue with Commerce module for this context.
Comment #11
alexpottSo we already have single word translations of Order with this context so I think we can fix this in 8.8.x too because the translation should exist already.
Committed and pushed 75df2611dc to 9.0.x and 98e9cbc3d7 to 8.9.x and 7fb03ff961 to 8.8.x. Thanks!
As a follow-up idea I think we could add an assert to
\Drupal\Core\StringTranslation\TranslatableMarkup::__construct()
that if $string is one word then $options['context'] must be set.Comment #15
andypost@alexpott thank you, nice idea - filed #3108111: Require context for one word translatables