Language variations (en-GB, en-AU, etc.)

Events happening in the community are now at Drupal community events on www.drupal.org.
andy inman's picture

Suppose some content has variants in en-GB, en-AU, etc, as well as plain en. If a user's language preference is en-GB, they should see en-GB content if available but if not they should see the standard en version. I am not aware of any way to do this with existing modules (though it wouldn't be very difficult to write.) Am I wrong? Is there some way to do this already? (with D6).

Comments

i18n module

frank ralf's picture

Hi Andy,

You could declare each variant as a separate language and then use i18n module's fall back mechanism to serve the default language. Using path discrimination should also work with such language variants.

http://drupal.org/project/i18n

hth
Frank

Only works for a simple case

andy inman's picture

Hi Frank,

Agreed, but that will only work when the site default is a suitable language. If you need to cater for multiple languages too, it's not a solution. Sorry, I should have said this in my original post - suppose we have en-GB, en-AU, en plus es-ES, es-MX, es, and so on.



Currently part of the team at https://lastcallmedia.com in a senior Drupal specialist role.

Combining with domain access?

frank ralf's picture

Well, that's a different story ;-)

You might try some combination with domain access:

HowTo: Different default languages per domain/subdomain
Different default languages per subdomain

Interesting idea

andy inman's picture

Ok, so I think you're saying use sub-domains, one per language. Then for each sub-domain configure a default language (so en.example.com would have default language en and other languages en-gb etc.) Interesting idea, sounds like it could work. Still no solution for single domain though (the more common requirement IME.)



Currently part of the team at https://lastcallmedia.com in a senior Drupal specialist role.

Sub-language discrimination by path

frank ralf's picture

If I understand correctly, the solution would be an extended language discrimination by path for sub-languages like so:

  • /en/GB/node/1
  • /en/AU/node/1
  • /es/ES/node/1
  • /es/MX/node/1

with /en/ and /es/ being the fallback language in each case. Perhaps you could suggest that as a feature request in the i18n module's issue queue?

Yes, something like that is

andy inman's picture

Yes, something like that is what's needed. I wanted to confirm that there was no way to do it with existing modules, which is what I believed to be the case. Seems a bit strange that its not a more common requirement,



Currently part of the team at https://lastcallmedia.com in a senior Drupal specialist role.

Same questions here

admataz's picture

@netgenius: Did you have much luck finding a solution to this? I have faced the same dilemma in the past (and opted for the Domains based solution) and am facing it again with a site that needs regional/local content AND translation. There appears to be little flexibility to the i18n fallback - which looks like it could do with a more hierarchical structure.

I'd be interested to hear what you discovered.

Automatic language variants

andy inman's picture

Just re-visiting this, @admataz - sorry, I didn't see your message at the time, now more than 3 years on, I guess it's a bit late :)

I never did find a solution, and the particular client that had wanted that functionality decided not to use language variants after all, primarily because it seemed like a lot of effort for very little real benefit.

One of the ideas I started (but didn't finish) working on recently was an automatic language-variant translator, i.e. to convert "American" to "British" content and so on, extensible, of course, to other languages and variants. It worked via a combination of pspell and some user-configurable rule-sets.
Currently waiting for more free time (or a paying client!) to get that into a usable state.



Currently part of the team at https://lastcallmedia.com in a senior Drupal specialist role.

"Language Fallback" module?

Adam_M's picture

Looks like this has been around for a while: Language Fallback.

From its description:

This module allows you to specify a language fallback for each defined language, so translation can fallback to another language.

Use case
Your site is using regional variants of languages, like Dutch Netherlands (nl-nl) and Dutch Belgium (nl-be), to set this up you first add the build in Dutch (nl) language and you define 2 custom languages (nl-nl and nl-be). If a string needs to be translated it will first check nl-be, and if the string isn't found it will check nl.

I'm not sure if it covers all the places where fallback is required (nodes, menus, views), but at least it seems to avoid requiring the cumbersome multiple-domain approach suggested above.

This might be solved by module Language Hierarchy

Adam_M's picture

I hadn't seen module Language Hierarchy before, looks like it was born in Nov 2013.

First of all, setup is very simple. After installing main module language_hierarchy, i18n's language management screen gets modified to enable setting up a hierarchy of languages with easy drag'n'drop handles.

I have tested the module with the following situations:

  • A page exists at /en/node/123. Pointing the browser to non-existent page /en-gb/node/123 falls back to using the content at /en/node/123 as expected. This uses sub-module node_translation_hierarchy.

  • A page exists at /en/about. Pointing the browser to non-existent page /en-gb/about falls back to the former page as expected. This uses sub-module language_hierarchy_paths (and prerequisite module pathinc).

  • A submodule called i18n_menu_hierarchy supports menu fallback, but at the time of writing needs a patch supplied in [#2653532]. The resulting behavior is that all menus defined in the base language (/en/) are displayed and have their links modified from /en/xxx to /en-gb/xxx.

Internationalization

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: