ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

Centralize locales in one common file

bcouvin 29 Jul, 2016
Hello,

Context:

I have several chronoforms and listings (around 20 pages). All use locales. To secure the translation, I built a table in Excel sheet a list of words and sentences to be translated as a translation dictionary. Each time I made a modification in this excel sheet, I just copy the the translation from my excel sheet dictionary to CV5 and CCV5 locales tabs.
As I have 20 pages to update, it is more interesting to centralize locales in one common file.

Question:

How to do that, or is it a solution for that to make my operations more simple?

Thanks
Bertrand
GreyHead 29 Jul, 2016
Hi Bertrand,

The answer is No - unless you hack the ChronoForms files. I just tested and this appears to work. Edit the file /components/com_chronoforms5/chronoforms/libs/form.php around line 169 like this
				if($tag_cap == $site_lang){
					/* Start hack */
					ob_start();
					eval('?>'.$lang_data['strings']);
					$lang_data['strings'] = ob_get_clean();
					/* end hack */
					$lines = explode("\n", $lang_data['strings']);
					$strings = array_map($_f, $lines);
And then add code like this in the locales tabs
<?php
include (JPATH_SITE.'/components/com_chronoforms5/includes/'.$this->form['Form']['title'].'/lang_en-gb.txt');
?>
and add your language strings in text files in the file shown there. In this case the path uses the form name but you can use another location if you want to use the same file in multiple forms.

Bob
bcouvin 10 Sep, 2016
Hello Bob,

Thank for your help.
I did not get the notification of Chronoengine messages since several months. Curious.

I just come back from vacation. I made a test this morning by following your advice.

I think I missed something.Please look at my 2 attached files.

Bertrand
GreyHead 14 Sep, 2016
Hi Bertrand,

Please remove the $form->form['Form']['title'] part from the form path as you aren’t using a sub-folder with the form name.

Bob
bcouvin 20 Sep, 2016
Hello Bob,

Thanx, that works fine. Last question: Where can I make this modification for Chronoconnectivity?

Bertrand
GreyHead 20 Sep, 2016
Hi Bertrand,

I don't know :-( Have you tried using the same code in the Language Strings box? It will depend whether Max has that set up to be evaluated as PHP or not.

Bob
bcouvin 20 Sep, 2016
Hello Bob,

Yes I did try. It was the first thing I did. In fact, in my first mail, I did it with CCV5 with an error on the include path, as you informed.
I tried with CFV5 with the correction on the path, that works.

I will write to Max if he could give me a help.

Thanks Bob
Bertrand
bcouvin 22 Sep, 2016
Hello Max,

Did you receive my question submitted from "Contact Us" form?
Let me know if I had a chance to centralize locales files in Chronoconectivity.
I still have 10 pages times 3 languages to be changed if I needed to change some translations.

Thanks,
Bertrand
Max_admin 17 Nov, 2016
Hi,

Same hack for connectivity, file:
\administrator\components\com_chronoconnectivity5\chronoconnectivity\helpers\lister.php
line 247:
if($tag_cap == $site_lang){
after it, just use the same lines provided by Bob above:
ob_start();
eval('?>'.$lang_data['strings']);
$lang_data['strings'] = ob_get_clean();

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
bcouvin 18 Nov, 2016
Hello Max,

Thanks for this help. I will test this hack and let you know soon.

Bertrand
bcouvin 21 Nov, 2016
Hello Bob and Max,

Both hacks work fine for CFv5 and CCv5. This is an added value that saved me 2 hours of workload for each modification because I have 12 CFv5 and 12 CCv5 times 3 languages. (24 x 3 locales).

This has to be included in the next versions.

Thanks
Bertrand
GreyHead 21 Nov, 2016
Hi Bertrand,

Great, thanks for letting us know.

Bob
bcouvin 27 Apr, 2017
Hello Bob, Hello Max

I tried to update:
ChronoForms5 to version 5.0.14 from 5.0.12
ChronoConnectivity5 to version 5.0.6 from 5.0.4

and make the necessay modification for

Chronoform --> /components/com_chronoforms5/chronoforms/libs/form.php
and
ChonoConnectiity --> /administrator/components/com_chronoconnectivity5/chronoconnectivity/helpers/lister.php

I got this error message when displaying the forms and listings:

0 - syntax error, unexpected ' ' (T_STRING)


I had the include file in language string:

<?php
include (JPATH_SITE.'/custom/includes/lang_en-gb.txt');
?>

Do you have an idea why?

Thanks
Bertrand
Max_admin 27 Apr, 2017
Hi Bertrand,

Does it go away when you remove the code below:
<?php
include (JPATH_SITE.'/custom/includes/lang_en-gb.txt');
?>
?

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com