Actions

Aangepaste vertaling

From LimeSurvey Manual

Revision as of 16:14, 8 July 2024 by Han (talk | contribs) (Created page with "# zoek de tekst in SourceMessage-tabel lime_source_message->message, haal het id op: lime_source_message->id # indien aanwezig, zoek de gerelateerde vertaling in berichtentabel lime_message->vertaling voor huidige taal lime_message->taal met huidige id lime_message- >id")

Inleiding

Sinds LimeSurvey 5.4.0 kunt u uw eigen vertaling krijgen voor alle teksten in alle opgenomen talen, met directe toegang tot uw database.

Dit systeem kan worden gebruikt als een bestaande vertaling niet compatibel is met uw zakelijke behoeften.

Het moet gereserveerd worden voor specifieke gevallen, omdat tekstwijzigingen in het hart van LimeSurvey opnieuw een aanpassing van uw database vereisen.

Bovendien kunt u deze methode gebruiken voor het vertalen van enquêtethema-specifieke teksten.

Hoe databasevertalingen werken

Voor databasevertalingen gebruikt LimeSurvey een methode geïnspireerd op CDbMessageSource uit het Yii-framework.

  1. zoek de tekst in SourceMessage-tabel lime_source_message->message, haal het id op: lime_source_message->id
  2. indien aanwezig, zoek de gerelateerde vertaling in berichtentabel lime_message->vertaling voor huidige taal lime_message->taal met huidige id lime_message- >id

LimeSurvey creates the array with translations from po file (see Translating LimeSurvey for information how to update this file), and afterwards merges it with all translations from the database.

Then the translations from the database are always returned if they exist.

Sample for “Submit” button in English and French

You want to show _Validate_ and not _Submit_ for the submit button in all of your surveys (with a specific theme). If you just update the theme and replace gT('Submit') by gT('Validate') : it always shows _Validate_ in all languages.

For all surveys with all themes

  1. Create the source message INSERT INTO lime_source_message (id, category, message) VALUES (NULL, NULL, 'Submit');
  2. Check the ID (if it's the 1st : ID is 1) and use it for next instruction
  3. Create the related translation : INSERT INTO lime_message (id, language, translation) VALUES ('1', 'en', 'Validate'), ('1', 'fr', 'Valider');

Using your own theme (recommended solution)

This method uses a solution with your own template, it updates the default string for all other languages as well.

  1. In Theme editor select the Navigation part
  2. Search for Template:GT("Submit") (in navigator.twig)
  3. Replace by Template:GT("Validate")
  4. Create the source message INSERT INTO lime_source_message (id, category, message) VALUES (NULL, NULL, 'Validate');
  5. Check the ID (if it's the 1st : ID is 1) and use it for next instruction
  6. Create the related translation : INSERT INTO lime_message (id, language, translation) VALUES ('1', 'fr', 'Valider');