X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Translation (https://forum.x-cart.com/showthread.php?t=77164)

_patricia 09-12-2019 11:43 PM

Translation
 
1 Attachment(s)
Hi,

Does anyone try to add the translation for modified modules?
Like I have a title and I try to use the translation from admin end but it doesn't work.

I have 2 languages in my store EN and AR.
Does anyone try this?

Thanks!

Ed B. 09-13-2019 09:32 PM

Re: Translation
 
Are you talking about your own modules, or ready-made ones? Il the latter, which one?

_patricia 09-15-2019 03:58 AM

Re: Translation
 
Hi ed,

My store has a 2 languages which is En and AR. We made a customize module which is for vendor listing and I would like also to translate it from EN to AR when a user try to use AR. I tried to use the translation in the admin but it doesn't work. Is there any code to able to work the translation?

Thank you so much

cflsystems 09-15-2019 05:24 AM

Re: Translation
 
Your custom module must be coded to support multiple languages. Any text label that you may want to translate should be outputted with the t method


t('text') - in twig files
static::t('text') - in php files


If you have models with text fields which needs to be translated you need to split the model to 2 classes to use languages - you can look how this is done for Product model for example - Product.php and ProductTranslations.php

Ed B. 09-15-2019 06:43 AM

Re: Translation
 
Quote:

Originally Posted by cflsystems

If you have models with text fields which needs to be translated you need to split the model to 2 classes to use languages - you can look how this is done for Product model for example - Product.php and ProductTranslations.php



See also https://devs.x-cart.com/basics/creating-mutlilanguage-entity.html for more on this.


All times are GMT -8. The time now is 05:52 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.