Jump to content

Field Name Module Translation

Rubens Cury

Recommended Posts

I'm looking for a way to translate my module fieldnames in order to allow to update them from the regular BO Translation tools.


The PS DOC says only the /classes/* files are available for. May I conclude that it's impossible for a module?




Field names translation

The following folder is parsed:

  • /classes/ and all of its sub-folders.

The string are those returned by the getValidationRules() method from ObjectModule for each class.

All the field names translations are stored in the following file, with iso_code being the ISO 3166-1 code (http://www.iso.org/iso/country_codes.htm) for the language of the translated strings (de, fr, en, it, es, etc.):

  • /translations/iso_code/fields.php

The translations are stored in a PHP array, named $_FIELDS, and take the following form:

  • $_FIELDS['Address_2df2ca5cf808744c2977e4073f6b59c8'] = 'Téléphone mobile';

The identification key is built by combining the name of the class from which the string comes, an underscore, and the MD5 hash of the string itself.



Link to comment
Share on other sites



Anybody Please explain how to do module templates translation. In my module, I have used the {l s="text_to_translate" mod="mymodule"} format.

Then through admin, localizattion->translation->modify translation ,
I have selected 'installed module translation' and the language into which to be translate. But I can't see the texts to be translated under mymodule. What's wrong with this?Do I missed anything?Plz help
Link to comment
Share on other sites

Hi Electriz,


Thank you for your reply, however, I'm not looking for a way to translate my inputs texts module but the TABLE FIELDS (firstname > Translated firstname) in order to display translated and friendly validation errors messages. Please, check the FIELD NAME TRANSLATIONS to see what kind of things I'm trying to translate.



Edited by Rubens Cury (see edit history)
Link to comment
Share on other sites

Ok, so I guess you try to do it in .tpl file in front office.


Let's make an example for email field.


You can use {$smarty.post.email} to retrieve a POST value and if it does not match validation, display a message.


For example, if email is empty.

{if isset($smarty.post.email)}
{l s='Please type something in' mod='mymodule'} {l s='email' mod='mymodule'} {l s='field' mod='mymodule'}

And you can do the same for another fields.

Link to comment
Share on other sites

Indeed, I'm developing a BO Module.


My solution was handle by the postProcess controller method each required field and display my custom message for them. For all the others not handled fields I decided to keep displaying the Prestashop core's auto translated - by default - error messages.


Doing that, the only problem I would still have is display the TABLE FIELD NAME instead of a custom field name, once users don't have to know the exactly table field meaning.


Thank you

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...