cancel
Showing results for 
Search instead for 
Did you mean: 

Localization and Internationalization of jsps in Hybris e commerce portal

Former Member
0 Kudos

Hi

I have a question on Internationalisation and localization.

We have a requirement where we are giving the language change option to customer on Customer Profile page. Once customer submits the request for language page, the whole page (i.e header, footer and the profile page ( which is a jsp) ) needs to be refreshed with the language that the user has submitted.

Can anyone please tell me what is the best approach for the same.

I referred Localization and internationalization documentation on wiki hybris, but it talks about Item Type localization etc etc.

I want localization on jsps for which i suposeHybris dont have any OOTB support (please confirm on this). Does tag usage will be a good option to go with?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Accelerator does this out of the box.

The "spring:theme" tag is used to get the localized text:

 <div id="productTabs">
     <div class="tabHead"><spring:theme code="product.product.details" /></div>
     <div class="tabBody"><product:productDetailsTab product="${product}"/></div>
     <div class="tabHead" id="tab-reviews"><spring:theme code="review.reviews" /></div>
     <div class="tabBody" ><product:productPageReviewsTab product="${product}"/></div>
     <cms:pageSlot position="Tabs" var="tabs">
         <cms:component component="${tabs}"/>
     </cms:pageSlot>
 </div>

which loads the message from properties files in /yacceleratorstorefront/web/webroot//WEB-INF

The above "product.product.details" from base_.properties:

 product.product.details           = Product details
 product.product.details.more      = More product details
 

If you are not using Accelerator, then you can deconstruct how this works and use the same mechanism.

Former Member
0 Kudos

Thanks a lot Konrad for your reply.

I have a question :

I am using B2bAccelerator and in my custom jsp i am going to use tag 1) Say On my customized customer Profile page , User changes the language say from english to thai and as part of it i made a change through below code:

userService.getCurrentUser().setSessionLanguage(LanguageModel corresponding to Thai language) Now after doing this if i refresh the page then will the localization gets applied automatically and the labels will be picked up from base_th.properties instead of base_en.properties??

Former Member
0 Kudos

Yes, it should work that way. As Richard said: check out the electronics demo store. If you switch language or currency there, the store is directly flipped to the new setting.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Konard, We have a similar requirement for french. However, was wondering if we can generate base_fr.properties file by using OOTB hybris language pack. Any suggestion will be very much helpful.

Thank You!

Former Member
0 Kudos

In addition to Konrads comments we have a fully working demonstrable approach in our B2C Electronic Store which we ship as a sample store with the Commerce Accelerator. Just ensure the electronicsstore AddOn is included in your localextensions.xml

Former Member
0 Kudos

Thanks Richard. It helped :)

Former Member
0 Kudos

Hi Vanshaj, We have a similar requirement as yours for french. However, was wondering if we can generate base_fr.properties file by using OOTB hybris language pack. Do you have any idea?

Regards, Roma