Jump to content

Multi-language Select with different content


Bike
 Share

Recommended Posts

Hello everyone,

 

I have a select field say "publishers" and I need its content to be different for every language. In the US there are different publishers than in GB.

How to set up this kind of field? Couldn't find anything about it.

Would be nice if someone could help ...

Link to comment
Share on other sites

There are different ways to accomplish this, as usual. The first coming to my mind right now is to use:

Basically you should have two page reference fields, one for each group of editors (eg. us_editors, gb_editors, etc.). Those page reference should point to the corresponding branch inside the page tree:

- Us Editors // page reference -> us_editors
-- editor #1
-- editor #2
-- ...
- Gb Editors // page reference -> gb_editors
-- editor #1
-- editor #2
-- ...


Then you might want to use a custom selector (custom selector option of the module linked above) based on your language to show only the correct page reference field.

Eg:

$user->language->id = 1234 // The id of the language the page field might be shown
//OR
$user->language->name = 'GB' // Or whatever the name you have choosen

Then in your template file you can work with the editors whom belong to the current user language

$editors = ($user->language->name == 'US') ? $page->us_editors : $page->gb_editors;

This method will fail shortly if you plan to have more than two languages.

Another, and probably more reliable, method is to use a hook on page creation and populate a single page reference with the values you need.
 

Link to comment
Share on other sites

Currently I don't think it's possibile with just one select field because options for language A must match options for language B (and so on...).
As far as I know you then need to select field (or page field) for what you are looking for.

Link to comment
Share on other sites

  • 2 months later...

Hi everbody,

I still didn't find any solution for this problem though I think it might be something not too fancy.

Looking for a select field (ASM too!) with language tabs. For each language there is not only a translation but an entirely different content.

Ex: Select field "Publishers". Field holds different lists of publishers for each language EN / DE / ES.

Or: ASM Select "Available as". Holds options such as "book", "ebook", "audiobook". Different selection possible for each language.

In case I am not making it clear enough have a look at the pictures ?

Unbenannt-3.jpg

Unbenannt-4.jpg

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...