In Drupal 7, t() has been beefed up to allow us to supply a context for strings that need to be translated. This is great for words like "Order" that have multiple meanings (is that Order as in I placed an Order or I need to adjust the sort Order of a column?). Gabor just wrote a blog post about this, so we need to ensure any necessary strings in the Commerce modules have context.

See: http://localize.drupal.org/node/2109

Comments

Jackinloadup’s picture

I remember running into the "Order" issue quite a bit in D6 ubercart. This will be great!

danillonunes’s picture

That would be awesome! Another string that can have contexts is "Checkout", that can act as verb or noun.

I think we can have all these strings documented somewhere, with all the contexts used, so it can be used as a reference for who will make modules based on Commerce.

rszrama’s picture

See #1010752: Use context in Views translatables where needed. for an example, where googletorp added context strings for Orders.

pcambra’s picture

Status: Active » Needs review
StatusFileSize
new1.53 KB

Ok, here's a patch for Rate, that in Spanish can refer to tax rates or vote rating.

Do we commit one to one or wait until have a bunch of them?

Also, see #1429822: Wrong localization context usage comments.

no2e’s picture

Shouldn't the current string translation (without context) be copied to the new string (with context)? Otherwise (iirc) all Commerce shops would display the English string after updating Commerce, although it might have been translated already.

rszrama’s picture

Issue tags: +1.3 review
simon georges’s picture

Bump?

sutharsan’s picture

Issue summary: View changes
StatusFileSize
new1.48 KB
new1.78 KB

The context "Drupal commerce tax rate" is specific to Drupal Commerce, but the translation isn't. For consistency of the user interface it is better to re-use strings and re-use translations. Therefore I suggest to change the context to "tax rate".

rszrama’s picture

Status: Needs review » Active
Issue tags: -string context, -1.3 review

Committed. Resetting to active to catch any others.

sutharsan’s picture

Issue tags: +string context

Restoring the 'string context' tag, as this is the best tool we currently have now group context related issues and thus attract other comments.

Status: Active » Needs work

The last submitted patch, 8: 952002-translation_strings-rates-8.patch, failed testing.

sutharsan’s picture

Status: Needs work » Fixed

Patch was already commited on dec. 17: git show a0b5127726ccb16258b44d6c6fae08a18905486e

Status: Fixed » Closed (fixed)

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

hansfn’s picture

Status: Closed (fixed) » Active

I can not see that the string checkout (with friends) has gotten any context? There are two problems:

  1. checkout can be a Git checkout or a shopping cart checkout
  2. checkout is used as a verb and noun

I'm sorry that I don't provide a patch for modules/checkout/commerce_checkout.module, but I don't know how to add a context in hook_menu implementations. In addition there is t('Checkout') and t('Checkout complete') and some more strings.