In norwegian the titles for a lot of the views pages turn out really strange. It seems to be because the config entity (is it a config entity)? called "view" gets translated. This means different things in english. Like "view" in "view source" and "view" in "this is a nice view". Could we get a context for the translation of that?

One example is the "are you sure you want to delete the view content" which gets translated like this (simplified):

t('Are you sure you want to delete the %type %label', array('%type' => t('View'), '%label' => 'Content'))

In norwegian the word "view" gets translated into something like the english word "show" (like in "show source" to continue my example above). So the sentence makes no sense :)

So... here is a patch that gives context to the entity type label of view... coming up.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

eiriksm’s picture

FileSize
466 bytes
eiriksm’s picture

...just discovered another place where this is very apparent.

If you enable config translation and wants to translate a view (on admin/config/regional/config-translation), there will be a list of different "config entities"(?) there. Among them "view", which in Norwegian gets translated to something like the word "show" (as explained above). This is fixed by applying the patch above.

I am pretty sure this must be an issue to other languages also. Should be fairly easy to review this one, but feel free to ask if anyone has any questions.

Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +D8MI, +language-ui, +sprint

Makes sense to me. Not sure this should get test coverage, looks good.

Mark_L6n’s picture

@eiriksm, sounds like a good idea.
Here's some high-level feedback from a perspective of computational linguistics and machine translation (MT):
You're correct that's a common problem, in fact much more common than most people realize. It often is discussed under "word-sense disambiguation", "lexical ambiguity" or "polysemy" (see ACL or Wikipedia). You'll see most MT systems have problems with this. To solve this, systems look at contexts (words, domains, etc.). Problems often seen:

  • When targeting one phenomenon, it's often hard to visualize all the other possibilities that your solution to the phenomenon might overgeneralize (get too much) or miss (get too little)
  • When specifying a list of contexts, it can be hard to split contexts up (overlap) or id all of them
  • Language is so varied and unpredictable, there might still be ambiguity in the context specified

So, maybe more info than you need, but I think you're on the right track in setting something up that looks at context for appropriate translations.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
function views_token_info() {
  $info['types']['view'] = array(
    'name' => t('View'),
    'description' => t('Tokens related to views.'),
    'needs-data' => 'view',
  );

I think we need to add the same context here.

eiriksm’s picture

Status: Needs work » Needs review
FileSize
935 bytes

That is a good point!

Tried to do a quick grep for other instances of it (might be what you just did, though) and found no other relevant t calls.

Anyway. Here is an updated patch.

Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me :)

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 554034a and pushed to 8.0.x. Thanks!

  • alexpott committed 554034a on 8.0.x
    Issue #2468565 by eiriksm: Entity type view should provide a context for...
Gábor Hojtsy’s picture

Issue tags: -sprint

Thanks!

Status: Fixed » Closed (fixed)

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