Which is the best practice of using Express Data Objects in a multilingual website?

Permalink
Hello world!


Greetings to c5 community. I suppose we are all digging right now the new feautures in version 8 and we are all thrilled.

I find express data objects really an excellent enhancment but i am missing something... How is supposed to be used on a multilingual website?

I would really like to know your thoughts on this.

dimger84
 
Mainio replied on at Permalink Reply
Mainio
Currently I think you need 1 dedicated object / language.

For 5.6 there was an add-on for multilingual attributes, you could also consider forking that for 5.7.

At some point, the core team is looking at making the attributes multilingual in the core but in case you need something now, I would not wait that.
NickKN replied on at Permalink Reply
I tried the addon for 5.6 - it gave you fields for ALL the available locales ! Or at least I couldn't find anywhere to turn off Afrikaans, for example.
I do have a routine for making relevant attributes multilingual, but it's a bit clunky and with the introduction of "site trees" I think the the API has changed significantly.
Basically it's "text" and "text-area" attributes that need an option to make one for each locale when you create the attribute - this then outputs the number of attributes required, each with a suffix of the intended language, for ex: for a site with 2 locales, English and German, an attribute "Skills Required" would become "Skills Required EN" and "Skills Required DE"
Mainio replied on at Permalink Reply
Mainio
I think it depends on each use case which attributes need to be multilingual and what not.

E.g. you might have a boolean attribute like "Product manual available in language" in which case you would obviously want to define different boolean value for each language.

So in case the attributes are made multilingual in the core, it should be flexible enough to support different use cases.
Hypocrite replied on at Permalink Reply
Hypocrite
Sorry to hijack your thread but I think this would be an ideal place to discuss how Express data objects should be used in multilingual sites.

Would be also interesting to know what is the original idea around the term Express?

It does not really open up at least for me why the new feature was named like this. We have been trying to find a good term for it in Finnish, but failed miserably.

Can they be called for example Data objects in other languages? Or what is the general purpose and idea behind them? I think they should also be obvious to editor users and at the moment their usage is pretty vague. Also there is no documentation or help about how they can be used efficiently.
NickKN replied on at Permalink Reply
From what I understand it is a method of creating a relational database within the site rather than having an external database from which data would have to be pulled to give the same effect.
There's a video that Andrew madehttp://youtu.be/Fub_Jstvpcs which explains it. His example is a business that has several workplaces and that wants to show who works where. So by linking the names of the employees to each workplace (which you can do with express data) you can output it automatically on the page.
For your translation, therefore, there is the concept of relational data and the speed and ease of maintenance of it. (speed data?... bit like speed dating!)
Hypocrite replied on at Permalink Reply
Hypocrite
Excellent.

That video and also this one explain them nicely:
https://www.youtube.com/watch?v=wNQcRTn74qY...

This has been actually something I have been needing also in previous versions of concrete5. Often you need some data in your website but don't want to create a page for them. This solves the problem really nicely.
NickKN replied on at Permalink Reply
Been giving a deal of thought to this and trying out express data but there seem to be bugs.
It seems to me that you create an attribute for each language where you need to and include it in your form for the entity - and then call the fields according to context through a custom template:

For what it's worth, this is the code I use for generating multilingual attributes - using the language codes you can call them according to context in your view.php :
use Concrete\Core\Multilingual\Page\Section\Section as mlSection;
use Localisation;
use Core;

if (\Core::make('multilingual/detector')->isEnabled()) {
$activeLocale = \Localization::activeLocale();
foreach (mlSection::getList() as $multilingualSection) {
$lng=$multilingualSection->getLanguage();//outputs 2 letter lower-case code for the language
$lngLabel= \Localization::getLanguageDescription($lng, null); //outputs full name of language in the language ie. English and français
$Title = FileKey::getByHandle('workTitle_'.$lng);
if (!is_object($Title)) {
$data = array(
'akHandle' => 'workTitle_'.$lng,
'akName' => t('Work Title').' '.$lngLabel,
'akIsSearchable' => true
);
}