Buy Now
Sign in

Centralize locales in one common file

bcouvin , July 29 2016, 08:17
B
bcouvin 213
July 29 2016, 08:17 #360953
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 64
July 29 2016, 09:35 #360954
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
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
B
bcouvin 213
September 10 2016, 09:32 #361668
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
Attachments
Screen Shot 2016-09-10 at 11.15.00.png
Screen Shot 2016-09-10 at 11.15.00.png
(147.86 KiB)
311 Downloads/Views
Screen Shot 2016-09-10 at 11.16.21.png
Screen Shot 2016-09-10 at 11.16.21.png
(195.41 KiB)
300 Downloads/Views
GreyHead 64
September 14 2016, 10:50 #361713
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
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
B
bcouvin 213
September 20 2016, 08:45 #361906
Hello Bob,

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

Bertrand
GreyHead 64
September 20 2016, 10:45 #361911
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
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
B
bcouvin 213
September 20 2016, 13:13 #361917
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
B
bcouvin 213
September 22 2016, 17:19 #361974
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
admin 27
November 17 2016, 18:14 #363092
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
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
B
bcouvin 213
November 18 2016, 17:51 #363126
Hello Max,

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

Bertrand
B
bcouvin 213
November 21 2016, 14:48 #363164
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 64
November 21 2016, 15:33 #363165
Hi Bertrand,

Great, thanks for letting us know.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
B
bcouvin 213
April 27 2017, 16:21 #367521
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
admin 27
April 27 2017, 20:46 #367528
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
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!