The standalone word state is used in various module as the label of a status column or such.

I think it's fair to assume the number of uses of the word State as an administrative area is much lower, so the context identifier needed to disambiguate should be put there.

Comments

helior’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev
Category: bug » task
StatusFileSize
new1007 bytes

Your patch throws errors because your context is not in the format that t() expects it to be. Here is an updated patch.

xandeadx’s picture

please commit

imiksu’s picture

Works for me.

However, some context naming guidelines would be nice to be declared. We could use similar context as field module does:

For example:

  • addressfield:plugin:country
  • addressfield:plugin:administrative_area
  • addressfield:plugin:locality
  • etc.
rszrama’s picture

Status: Needs review » Fixed

Curious... I thought I updated this issue earlier when I made the commit. I guess it didn't save... in any event, I added a simple "addressfield" context, as I think when I read the documentation that the context should function more like a general taxonomy term for a realm of strings than a description of the string in question - I think we got this wrong in Commerce itself. C'est la vie.

Commit: http://drupalcode.org/project/addressfield.git/commitdiff/1ac0256fb924ef...

hass’s picture

Status: Fixed » Needs work

Sorry, but a "context" should explain the meaning of the string not a module name. Otherwise translators cannot translate it properly without looking into module code where a string is used e.g. Territory of a country.

http://en.wikipedia.org/wiki/State

rszrama’s picture

Status: Needs work » Fixed

Not according to http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/t/7. It simply says the string should be "The context the source string belongs to." That doesn't sound like a meaning / explanation to me, and without further documentation on the topic, I'm not inclined to be more verbose. Do you have any links to better examples / explanations?

hass’s picture

Status: Fixed » Needs work

Nonono... This is api doc not translation docs. My example is good. Core has such an example, too.

How should I know as translator ***what*** You mean with this context. This is not the way how this need to be written. Looking for the doc link. May take some time. Keep in mind translators may not use your module. They only see the string, nothing else!

hass’s picture

rszrama’s picture

Alternative proposals would be most welcome. "Part of a postal address," perhaps?

hass’s picture

This does not sounds very good to me. The context should describe what the string means and not where it's also shown. My suggestion sounds usefull and could also used by other modules as it's not module specific, too.

rszrama’s picture

Status: Needs work » Needs review

So you don't think seeing "State, part of a postal address" is enough to help a translator know how to translate a word? Again, we're looking to just make sure translators know how a string is used, not define the word. This context has the additional benefit of being useful for other parts of the postal address if we need to add a context to them.

hass’s picture

The word "state" can be used in other situations like a map, too. It's not necessarilly part if an address field. The context's used in commerce packages are one of the worst examples for context usage. Don't write it this way, please.

rszrama’s picture

Tell me about it. That's what I'm trying to avoid by not aiming for a definition but describing the context in which the string is used. Honestly, looking at the context list that documentation page links to, just about everyone else has simply been using their module name.

aturetta’s picture

Ryan, you need to think about SEMANTIC context, not programming context.
The translator will see 'State' as original string, what it misses is 'Are we talking about a geographic entity or not?'
That's the meaning of context.
Please consider using a generic context that can be reused in most places where it applies. So lot of different strings with a 'geography' context are more appropriate than a dedicated context that's valid only for a single string (in particular, I see no need to repeat the word to be translated inside the context string).

hass’s picture

Yep, thx.

I see no need to repeat the word to be translated inside the context string

This would not help understanding the string either :-)

rszrama’s picture

@aturetta The semantic context is its use in relation to being part of a postal address. That was my recommendation above, and it has nothing to do with the code. :-/

hass’s picture

Your example makes it impossible to reuse the string in other context where it's not part of an addressfield. A State can be used in many situations and I do not like to translate it 100 times just for the reason that you write once; part of an addressfield; part of a map; blah blah blah... With my context suggestion we can use it for all of these.

hass’s picture

How about committing my recommended fix now? Territory of a country

xibun’s picture

2 more ideas:
federated state (ok, repeating state.. but maybe more clear then next one)
federated unit (see column header here: http://en.wikipedia.org/wiki/Federated_state)

hass’s picture

Sounds not good to me. If you "explain" something you should not use the same words as it confuses the same way. Use other words.

xibun’s picture

federated unit doesn't repeat the word "state"
(and I don't think this is about "explaining" I think it is about "disambiguation")

hass’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.16 KB

Patch attached.

imiksu’s picture

Status: Reviewed & tested by the community » Needs review

Just wondering, but is it common to update translations on update hooks (especially when changing context)?

#22 patch would cause an existing translation to get thrown away.

hass’s picture

Status: Needs review » Reviewed & tested by the community

No. Post release you need to translate on l.d.o and reimport translations e.g with l10n_update.

Yes, an invalid translation reverts to english. This is as designed.

rszrama’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Honestly, I'm not sure it's worth breaking existing translations to update this, but so the context might be used by other modules, I'll make the change now - better in a beta than a final release. hass, any chance you can convince other relevant modules to use the same translation context string?

Commit: http://drupalcode.org/project/addressfield.git/commitdiff/cbaab93

hass’s picture

I will try to identify them :-). Thx.

aturetta’s picture

Thanks Ryan!

Status: Fixed » Closed (fixed)

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