Custom translation/ja: Difference between revisions
From LimeSurvey Manual
Bravehorse (talk | contribs) Created page with "=「送信」ボタンの例(英語とフランス語)=" |
Bravehorse (talk | contribs) Created page with "(特定のテーマと共に)すべてのアンケートの送信ボタンについて、_Submit_ではなく_Validate_を表示したいとします。テーマを更新し、gT('Submit')をgT('Validate')に置き換えると、すべての言語で常に_Validate_が表示されます。" |
||
Line 26: | Line 26: | ||
=「送信」ボタンの例(英語とフランス語)= | =「送信」ボタンの例(英語とフランス語)= | ||
(特定のテーマと共に)すべてのアンケートの送信ボタンについて、_Submit_ではなく_Validate_を表示したいとします。テーマを更新し、gT('Submit')をgT('Validate')に置き換えると、すべての言語で常に_Validate_が表示されます。 | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> |
Revision as of 11:20, 25 May 2024
はじめに
LimeSurvey 5.4.0以降では、データベースへの直接アクセスによって全言語のあらゆる文字列を独自に翻訳することができます。
既存の翻訳がビジネスニーズに適合しない場合にこのしくみを使用することができます。
LimeSurveyの中核部分のテキストを変更すると、データベースを変更する必要があるため、特定の場合にのみ使用してください。
さらに、このしくみを使用すれば、アンケートテーマ固有の文字列を翻訳することもできます。
データベース翻訳のしくみ
データベースの翻訳は、LimeSurveyはYiiフレームワークのCDbMessageSourceから着想を得た方法を使用しています。
- SourceMessageテーブルのlime_source_message->messageで文字列を検索し、lime_source_message->idからidを取得します。
- 存在する場合、対象のid lime_message->idを持つ言語lime_message->languageのMessageテーブルの関連する翻訳 lime_message->translationを検索します。
LimeSurveyは、poファイルから翻訳の配列を作成し(このファイルの更新方法についてはLimeSurveyの翻訳を参照してください)、その後、データベースのすべての翻訳とマージします。
データベースに翻訳がある場合、常にその翻訳が返されます。
「送信」ボタンの例(英語とフランス語)
(特定のテーマと共に)すべてのアンケートの送信ボタンについて、_Submit_ではなく_Validate_を表示したいとします。テーマを更新し、gT('Submit')をgT('Validate')に置き換えると、すべての言語で常に_Validate_が表示されます。
For all surveys with all themes
- Create the source message
INSERT INTO lime_source_message (id, category, message) VALUES (NULL, NULL, 'Submit');
- Check the ID (if it's the 1st : ID is 1) and use it for next instruction
- 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.
- In Theme editor select the Navigation part
- Search for
Template:GT("Submit")
(in navigator.twig) - Replace by
Template:GT("Validate")
- Create the source message
INSERT INTO lime_source_message (id, category, message) VALUES (NULL, NULL, 'Validate');
- Check the ID (if it's the 1st : ID is 1) and use it for next instruction
- Create the related translation :
INSERT INTO lime_message (id, language, translation) VALUES ('1', 'fr', 'Valider');