cancel
Showing results for 
Search instead for 
Did you mean: 

Importing localized values in datahub

Former Member
0 Kudos

Hi,

I want to import ProductFeature in hybris using datahub. I want to know, do I need to explicitly define 'isoCode' in Raw, and model it accordingly in canonical and target? Also, while passing 'value' in hybris(ie in impex), what would the transformation expression be? I made a small implementation and while the impex runs successfully, no data is entered into the hybris database, and sometimes even if it does, it does not reflect in hMC. I am using CSV import method, and running datahub v5.5.1.0-RC9

Any pointers will be appreciated.

Regards, Nikhil

Accepted Solutions (1)

Accepted Solutions (1)

former_member224482
Active Contributor
0 Kudos

The first step for all Data Hub integration is to define the canonical model.
The canonical item attribute needs <localizable>true</localizable>.

The second step is the raw model.
At this step you either use the predefined isoCode column or you will have to write your own composition handler where at the end you execute CanonicalItem.setField("attributeMultiLang", "Hello", new Locale("en"));

The third step is the target model. The target item attribute also needs <localizable>true</localizable>. There is no transformation needed as each value in their language remain unchanged.
At this point it is important to understand the meaning of <mandatoryInHeader>true</mandatoryInHeader>. The mandatoryInHeader shall be true for all field [unique=true] and fields with mandatory interceptor logic. Only the field marked with mandatoryInHeader will be repeated for importing the language specific lines. Yes, the Data Hub will generate multiple impex lines for the same canonical in order to import all the languages.

Unfortunately, many customers end up defining the 2-3 languages they use as separate not localized fields. And use 2-3 fields in the target with impex exportCode [lang=XX].

Former Member
0 Kudos

Hi Robin,

Thanks for the valuable information. So I write a localization based handler for dealing with locale as follows.

private T copy(final T item, final Locale lang, final Object collValue) { try { @SuppressWarnings("unchecked") final T copy = (T) item.clone(); Map value = new HashMap(); value.put("value", collValue); copy.setField(canonicalAttributeName, value); copy.setField("language", lang); return copy;...

Then do I need to include 'isoCode' in Raw model?

Answers (1)

Answers (1)

jseidl
Explorer
0 Kudos

Hi, We're also trying to transfer localized fields via y2ysync and datahub (v6.6). Since we have 12 languages and ~50 attributes, defining separate, not-localized fields is absolutely no option.

For e.g. Product we defined the name attribute <localizable>true</localizable> for both canonical and target models.

From the hybris source system, we export Impex columns name_de, name_en, name_el, etc. But how is the "automatic" composition done on datahub-side via this isoCode column? I went through all datahub examples hybris provides but can't find how the isoCodefield on an attribute-level is supposed to work.

So I'm repeating Nikhil's question above: "Then do I need to include 'isoCode' in Raw model?" Would be great if you could provide an example, Thank you in advance!

jseidl
Explorer
0 Kudos

Found out that the "isoCode" field cannot be applied when the data is transferred to datahub via y2ysync. It can only be used in conjunction with "The CSV Web Service Extension" https://help.hybris.com/6.6.0/hcd/9677910439ac4268ba3d515e911279b5.html (see screenshot).

jseidl
Explorer
0 Kudos

For our scenario I now created separate Y2YColumnDefinitions for each localized attribute (using impex includes to not having to copy all 12 languages for each localized attribute) on the source side. In the datahub's raw definition I also needed to define the 12 languages as separate raw attributes (name_en, name_de, ..), but again with an Include mechanism (java class executed via maven within raw module, which replicates a localized attribute within raw xml to all needed languages).

jseidl
Explorer
0 Kudos

At last, I replaced the default LocalizedCompositionRuleHandler which then composes a single canonical attribute out of the multiple raw attributes.

  • Incredibly much effort for such a simple scenario, but obviously nobody else needs that..