Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Translation

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 09-12-2019, 11:43 PM
 
_patricia _patricia is offline
 

Member
  
Join Date: Mar 2019
Posts: 17
 

Default Translation

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!
Attached Thumbnails
Click image for larger version

Name:	translate.PNG
Views:	275
Size:	5.4 KB
ID:	5373  
__________________
Multi-vendor 5.3.6.0
Reply With Quote
  #2  
Old 09-13-2019, 09:32 PM
 
Ed B. Ed B. is online now
 

X-Adept
  
Join Date: Apr 2016
Posts: 453
 

Default Re: Translation

Are you talking about your own modules, or ready-made ones? Il the latter, which one?
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
  #3  
Old 09-15-2019, 03:58 AM
 
_patricia _patricia is offline
 

Member
  
Join Date: Mar 2019
Posts: 17
 

Default 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
__________________
Multi-vendor 5.3.6.0
Reply With Quote
  #4  
Old 09-15-2019, 05:24 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,199
 

Default 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
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 09-15-2019, 06:43 AM
 
Ed B. Ed B. is online now
 

X-Adept
  
Join Date: Apr 2016
Posts: 453
 

Default 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.
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:55 AM.

   

 
X-Cart forums © 2001-2020