- Posts: 20
- Thank you received: 0
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
- Topic Author
- Offline
- Junior Member
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?
- tpartner
- Away
- LimeSurvey Community Team
- Posts: 10109
- Thank you received: 3593
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
- DeveloperChris
- Topic Author
- Offline
- Junior Member
- Posts: 20
- Thank you received: 0
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.
- jelo
- Offline
- Platinum Member
- Posts: 5033
- Thank you received: 1257
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
- tpartner
- Away
- LimeSurvey Community Team
- Posts: 10109
- Thank you received: 3593
If that file is overwritten, it is (in my opinion) a bug, not a missing feature. Please file a bug report.surveytranslator_helper.php is a core file and will be overwritten with an update.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
- jelo
- Offline
- Platinum Member
- Posts: 5033
- Thank you received: 1257
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:tpartner wrote:
If that file is overwritten, it is (in my opinion) a bug, not a missing feature. Please file a bug report.surveytranslator_helper.php is a core file and will be overwritten with an update.
// 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
- tpartner
- Away
- LimeSurvey Community Team
- Posts: 10109
- Thank you received: 3593
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
- holch
- Offline
- LimeSurvey Community Team
- Posts: 11658
- Thank you received: 2742
This is, at least partially, already the case.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.
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.
- jelo
- Offline
- Platinum Member
- Posts: 5033
- Thank you received: 1257
The language-codes have to be unique.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.
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
- holch
- Offline
- LimeSurvey Community Team
- Posts: 11658
- Thank you received: 2742
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.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.
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.