Multilanguage value select attribute

Permalink 1 user found helpful
How can you setup the value for the select attribute in a multilanguage way?

Color:
- White
- Black
- Grey

Can it be done by adding values to the translations files?

Dutchwave
 
goutnet replied on at Permalink Reply
Depending on where your select is, you have multiple answers:

- if your select resides in a custom block : use t("your option") in the block and then extract strings from your block and translate them into your block LOCALES.

- in a form block (no coding involved), the option string actually resides in the database, so there is no way (currently) to have a multilanguage support here. The workaround is to have different pages serving different languages (use the Internationalization addon for this).
Dutchwave replied on at Permalink Reply
Dutchwave
Sorry I mean the values of a select PAGE attribute.
Guessing these values end up in the database?
Dutchwave replied on at Permalink Reply
Dutchwave
Is there really no work around? Its a shame that you would need to create duplicate page types just to accomplish translated attributes.
From a users perspective not really the way to. Instead of selecting an attribute once, with 4 languages this needs to be done 4 times.
adajad replied on at Permalink Reply
adajad
Since the attribute is created by you, and you supply the content (in this case 'White', 'Black', 'Grey'), there is no way for the system to know how to translate those options. For translattion to work, you need to wrap all words to be translated with t('word(s) to translate') in the code.
Dutchwave replied on at Permalink Reply
Dutchwave
Agreed. That's why in my opinion I think the system should be extended for multilanguage projects. Right now it works, but its just no there yet.
Would be great if you could enter values in multiple languages.

Same for setting up page types. The default values can only be in one language. Why not set a page type up for multiple languages. Would reduce the amount of page types a lot.

Ok for for easy simple sites it doesn't really matter but as soon you want more, the easy user-friendliness of concrete5 becomes quite the apposite.

But still, looking for a work around. :)
Load the values in a block and then translate them, would that work? (except for the nondynamic part)
drbiskit replied on at Permalink Reply
drbiskit
Hi - Did you ever find a nice solution for this?
Remo replied on at Permalink Best Answer Reply
Remo
use localizer, it's a great add-on and allows you to translate lots of core things, file set names, attribute key names etc.

https://github.com/mlocati/concrete5-localizer...
drbiskit replied on at Permalink Reply
drbiskit
Nice one Remo - thanks!
=0)
drbiskit replied on at Permalink Reply
drbiskit
I have installed localizer, and everything is enabled under localizer options, but how/where do I now set up / configure the translations?

I have page attributes and their respective option values that need to be translated - so e.g. - I have a select attribute called 'colour', with options: blue, green, red, etc.

Many thanks.

UPDATE
it seems that I needed just to re-index the site in order for the 'Translate special items' page to appear in the dashboard. Strange, but when I first installed the package, and went to the localizer page, it would only show me the 'options' page. I re-indexed the site and the 'Translate special items' page is now there too.
drbiskit replied on at Permalink Reply
drbiskit
I have installed Localizer on my site, and made all the translations for my page select attributes. I can't work out the correct syntax to show the selected value/s on my site...

As an example - I have a page select attribute called 'colour', with option values of Blue, green and Red. Each page of a particular page type will have 1 of these attribute options selected. I need to show the selected translated option on the site - so in the page template file I am using the following code:

echo $c->getCollectionAttributeValue(tc('SelectAttributeValue', 'colour'));


Which outputs the default value, but it's not translated, it just shows it's default 'en_GB' value.

NB - I have tried the method outlined here (ie retrieving the locale of the current page):
https://www.concrete5.org/marketplace/addons/localizer/forums/attrib...
- and it doesn't seem to make any difference

Can anyone help me out on the correct syntax to use please?

Thanks!
Remo replied on at Permalink Reply
Remo
try this

echo tc('SelectAttributeValue', $c->getCollectionAttributeValue());
drbiskit replied on at Permalink Reply
drbiskit
Ah, That worked a treat!

Thank you Remo, that's very much appreciated.