4

How can I translate the Freemember error messages into a different language?

Specifically the error message like: The {field_name} is required.

3

That particular message you are looking for comes directly from ExpressionEngine. You can translate the built in EE strings in the same way (in your system/expressionengine/language folder).

Another option if you don't want to bother translating EE is to use the error variables as conditionals. Instead of {error:field_name}, you can use:

{if error:field_name}
    Custom error message
{/if}
1
  • One problem with this method is that the value of {error:field_name} isn't always the same. For an email field, it can be either "The email you chose is not available" or "The email you chose is not valid". You'd have to use {if error:field_name == "[the error message you want to match]"}Alternate message{if:elseif error:field_name == "[another hard-coded error]"}Another alt. message{/if} - which sucks.
    – Sandwich
    Feb 18 '15 at 15:32
1

You should be able to add a language file to the add-on.

Duplicate the directory expressionengine/third-party/add-on-name/language/english, rename it as the appropriate language then modify the file within it with your new language.

This next bit is an assumption on my part... How you tell EE to use that language is, I think, down to the locale settings for the site/member in question. If an appropriate language file exists for their selection then it will be used.

2
  • I checked the included language file already. But that file only includes the dictionary for the module itself and not for the front-end side. Jan 21 '13 at 10:50
  • I misunderstood your question then. I'm not really familiar with Freemember.
    – foamcow
    Jan 21 '13 at 10:56
0

To make te translation for the tag {error:field_name}, you must do a translation in codeigniter. The specific form translation are in the file:

system\codeigniter\system\language\english\form_validation_lang.php

I don't know how the select a different language for codeigniter so I just translated the English files because I only need one language.

1
  • Not all messages are part of CodeIgniter. In EE 2.9.2, when trying to register a new account using an email that's already registered, for example, you get the message on line 453 of /system/expressionengine/language/english/myaccount_lang.php: "The email you chose is not available".
    – Sandwich
    Feb 18 '15 at 15:51

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .