Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

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

  • DeveloperChris
  • DeveloperChris's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 2 months ago #172869 by DeveloperChris
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?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 2 months ago #172871 by tpartner

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DeveloperChris
  • DeveloperChris's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 2 months ago #172882 by DeveloperChris
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.
The topic has been locked.
More
6 years 2 months ago #172883 by jelo
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?

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 2 months ago #172887 by tpartner

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.
The topic has been locked.
More
6 years 2 months ago - 6 years 2 months ago #172888 by jelo

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:
Code:
// 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.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Last edit: 6 years 2 months ago by jelo.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 2 months ago #172889 by tpartner
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.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 2 months ago - 6 years 2 months ago #172891 by holch

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 answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Last edit: 6 years 2 months ago by holch.
The topic has been locked.
More
6 years 2 months ago #172895 by jelo

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.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 2 months ago #172902 by holch

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 answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose