Translate labels of fields and validation rules in language files

georgie

Member
Hi

I have a multilingual website, with lists in several languages.

It works very well, but I think I did not use the most effective method :

In order to translate as I want the labels of fields and validation rules, my lists exist in several languages : such list exists in 2 if I have 2 languages.

This adds a lot of maintenance to me because if I make changes on a list, I have to do on all other similar lists in other languages...

Is there a method to translate the titles of the fields and validation rules "on the fly" (directly in language files) ?

Thank you
 
You can use Joomla's language override feature to translate your labels, error messages...
Add your "language key string" as label etc. (best is to use someting like MYPREFIX_YOUR_SHORT_TEXT), then go to Extensions/LangManager/Overrides and add the translated texts.

http://fabrikar.com/forums/index.php?wiki/make-fabrik-multilingual-with-fabrik-itself/

There are some recent threads, too
http://www.fabrikar.com/forums/index.php?threads/multi-language-site-advice.40971/
http://www.fabrikar.com/forums/index.php?threads/dbjoin-label-translation.41010/
 
OK yes it works very well ! Many thanks !!!

Only problem: the string appears in the fields of Advanced research...:(

Can this be solved ?
 
What template is this, and how is it being rendered? Are you using a {fabrik ...} content plugin, or a module position?

The DOM source just doesn't seem to match anything in our templates where the title is being rendered (for instance, we should be wrapping a div with class 'componentheading' round the title), so I'm a bit confused as to where that is coming from.

-- hugh
 
Re the PR, no, I don't think it would be too "expensive", as all JHtml::_() really does is a strtoupper() on the text, then checks to see if the resulting string is set in an array of current language strings.

It also does some "funky stuff" if there is a comma in the text, but that's why we replaced all calls to JText::_() with FText::_(), which is really just a wrapper which checks to see if there is a comma in the text, and if so returns it un-touched. If no comma, run it through JText::_().

The comma handling in JText does have a purpose, to do with sprintf'ing a language string with args, but it's very corner case, and we've yet to find a place where we need that. And it just screws with the more general purpose use of JText::_(), when you don't know if the string is really going to be an actual language tag, or just random text. If we ever find anywhere which needs J!'s sprintf handling of language strings, we'd call JText in that context rather than FText.

So anyway, I'll merge the PR, we'll take another look if it does turn out to be an issue.

-- hugh
 
As far as I can tell, all those things should be translated, check out ./components/com_fabrik/views/list/tmpl/_advancedsearch.php, for instance ...

Code:
<?php echo FabrikHelperHTML::image('plus.png', 'list', $this->tmpl);?>
<?php echo FText::_('COM_FABRIK_ADD')?>

... and ...

Code:
<th><?php echo FText::_('COM_FABRIK_ELEMENT')?></th>
<th><?php echo FText::_('COM_FABRIK_CONDITION')?></th>
<th><?php echo FText::_('COM_FABRIK_VALUE')?></th>
<th><?php echo FText::_('COM_FABRIK_DELETE')?></th>

Can you check that file and make sure it's up to date?

-- hugh
 
Hi

Yes indeed, there is no problem on these translations, sorry it was probably an error of care from me...

However I notice there is something that does not take into account the translation string :

In form, in detail view only, the title in the navigator display the string, not the translation.


Hihi sorry!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top