Can I create a new customised language file without editing core?

More
1 month 2 days ago #172869 by DeveloperChris
DeveloperChris created the topic: Can I create a new customised language file without editing core?
We routinely change our language file to replace the word survey with form. thats because the majority of our work is form submissions not surveys as such.

Normally I have been lazy and just updated the existing en language file and got on with my life. but we are doing this more often now so it is consuming appreciable time.

I wrote a short script that does it for me now. I'd like to formalise the process and save it as a new language file. Unfortunately it seems the only way to get LS to recognise it is if I edit surveytranslator_helper.php

That's a core file and I should not be touching it!

Is there another way of getting LS to recognise a new language by say adding it to the config file?

Please Log in or Create an account to join the conversation.

More
1 month 2 days ago #172871 by tpartner
tpartner replied the topic: Can I create a new customised language file without editing core?

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: LouisGac

Please Log in or Create an account to join the conversation.

More
1 month 2 days ago #172882 by DeveloperChris
DeveloperChris replied the topic: Can I create a new customised language file without editing core?
The page you linked is the one I was referring to when I said about editing core.


8. To make LimeSurvey know about your language, you must add it in application/helpers/surveytranslator_helper.php (located in the LimeSurvey root directory). Open that file with a text editor and add your language in the same way the other languages are defined in that file.


surveytranslator_helper.php is a core file and will be overwritten with an update.

Please Log in or Create an account to join the conversation.

More
1 month 2 days ago #172883 by jelo
jelo replied the topic: Can I create a new customised language file without editing core?
You want to create a "new" or " customized" language?
New language = new language code (currently unknown to the world)
Customized language = known languages code and the language itself is modified.

feature request: Allow adding new languages without modifying surveytranslator_helper.php.
Perhaps enumeration of directory with PO-files? Or Config?

Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey

Please Log in or Create an account to join the conversation.

More
1 month 2 days ago #172887 by tpartner
tpartner replied the topic: Can I create a new customised language file without editing core?

surveytranslator_helper.php is a core file and will be overwritten with an update.

If that file is overwritten, it is (in my opinion) a bug, not a missing feature. Please file a bug report.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in or Create an account to join the conversation.

More
1 month 2 days ago - 1 month 2 days ago #172888 by jelo
jelo replied the topic: Can I create a new customised language file without editing core?

tpartner wrote:

surveytranslator_helper.php is a core file and will be overwritten with an update.

If that file is overwritten, it is (in my opinion) a bug, not a missing feature. Please file a bug report.

Why should that be an bug? If you want to ADD a new language, you will need to create a new language code description with a few settings like this:
// Czech informal
$supportedLanguages['cs-informal']['description'] = gT('Czech (informal)');
$supportedLanguages['cs-informal']['nativedescription'] = 'Česky neformální';
$supportedLanguages['cs-informal']['rtl'] = false;
$supportedLanguages['cs-informal']['dateformat'] = 4;
$supportedLanguages['cs-informal']['radixpoint'] = 1;
$supportedLanguages['cs-informal']['cldr'] = 'cs';

These settings could be placed into an external config file per language, which needed to be read into the database. Or a setup section for languages directly in the GUI, where you could copy, modify like with Themes (PO generation might be still done in an external step).

If you think languages a bit different, there are sometimes projects which would need an languages more than once. E.g. a survey in English, but in different countries (USA,UK and also e.g. India). Would be nice to put them in one survey.

Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey
Last Edit: 1 month 2 days ago by jelo.

Please Log in or Create an account to join the conversation.

More
1 month 2 days ago #172889 by tpartner
tpartner replied the topic: Can I create a new customised language file without editing core?
I think it's a bug because the manual describes how to add a language but then it will break on updating.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in or Create an account to join the conversation.

More
1 month 2 days ago - 1 month 2 days ago #172891 by holch
holch replied the topic: Can I create a new customised language file without editing core?

If you think languages a bit different, there are sometimes projects which would need an languages more than once. E.g. a survey in English, but in different countries (USA,UK and also e.g. India). Would be nice to put them in one survey.

This is, at least partially, already the case.

For Portuguese we have Portuguese from Brazil and from Portugal.

Or for Spanish we have Argentina, Mexico, Chile, etc.

We even have two German languages. So I this is already here.

Now the question is, how to guarantee that the file, where you add your custom languages is not overwritten via an update, because this doesn't make sense.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
Last Edit: 1 month 2 days ago by holch.

Please Log in or Create an account to join the conversation.

More
1 month 2 days ago #172895 by jelo
jelo replied the topic: Can I create a new customised language file without editing core?

holch wrote: Now the question is, how to guarantee that the file, where you add your custom languages is not overwritten via an update, because this doesn't make sense.

The language-codes have to be unique.

You have official ones and future official ones.
pt-BR for Brazilian Portuguese is official. pt for Portuguese with the tag BR for Brazil.
en.wikipedia.org/wiki/IETF_language_tag

And now customized ones, which are only available in the local installation.
Perhaps a prefix or postfix to the languagecodes.


What I want to see, is the possibility to add the language English more than once to a survey files and only modify a few things (e.g date format). This is currently not possible. This is not uncommon for worldwide business surveys to ask in English with a few modifications (date format, currency, time). You can copy 99% of the content but would like to have a URL to the specific English language. Even if this is the same PO language file, it would be nice to have the chance to make use of a language more than once via different languagecodes.

Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey

Please Log in or Create an account to join the conversation.

More
1 month 2 days ago #172902 by holch
holch replied the topic: Can I create a new customised language file without editing core?

Perhaps a prefix or postfix to the languagecodes.

Agreed. Maybe something like "lc_" for "local" or "cm_" for "custom". Would need to check if those don't collide with any other language tag.

What I want to see, is the possibility to add the language English more than once to a survey files and only modify a few things (e.g date format). This is currently not possible. This is not uncommon for worldwide business surveys to ask in English with a few modifications (date format, currency, time). You can copy 99% of the content but would like to have a URL to the specific English language. Even if this is the same PO language file, it would be nice to have the chance to make use of a language more than once via different languagecodes.


I agree, more flexibility would be great. Or an easy way to overwrite the language files at the back end. But this would be probably a lot of programming and thus the language file solution is probably the better one.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!