Actions

Custom translation/ja: Difference between revisions

From LimeSurvey Manual

(Created page with "=データベース翻訳のしくみ=")
(Created page with "# テーマエディターのナビゲーションパートを選択する # <code>{{ gT("Submit") }}</code>を検索する(navigator.twig内) # <code>{{ gT("Validate") }}</code>に置き換える # ソースメッセージを作成する:<code>INSERT INTO lime_source_message (id, category, message) VALUES (NULL, NULL, 'Validate');</code> # 以下の手順で使用するため、IDを確認する(もし1番の場合:IDは1) # 関連する...")
 
(11 intermediate revisions by the same user not shown)
Line 14: Line 14:
=データベース翻訳のしくみ=
=データベース翻訳のしくみ=


<div lang="en" dir="ltr" class="mw-content-ltr">
データベースの翻訳は、LimeSurveyはYiiフレームワークの[https://www.yiiframework.com/doc/api/1.1/CDbMessageSource CDbMessageSource]から着想を得た方法を使用しています。
For database translations, LimeSurvey uses a method inspired by [https://www.yiiframework.com/doc/api/1.1/CDbMessageSource CDbMessageSource] from the Yii framework.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
# SourceMessageテーブルのlime_source_message->messageで文字列を検索し、lime_source_message->idからidを取得します。
# find the string in SourceMessage table lime_source_message->message, get the id : lime_source_message->id
# 存在する場合、対象のid lime_message->idを持つ言語lime_message->languageのMessageテーブルの関連する翻訳 lime_message->translationを検索します。
# if exists, find the related translation in Message table lime_message->translation for current language lime_message->language with current id lime_message->id
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
LimeSurveyは、poファイルから翻訳の配列を作成し(このファイルの更新方法については[[Translating LimeSurvey/ja|LimeSurveyの翻訳]]を参照してください)、その後、データベースのすべての翻訳とマージします。
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.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
データベースに翻訳がある場合、常にその翻訳が返されます。
Then the translations from the database are always returned if they exist.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Sample_for_“Submit”_button_in_English_and_French"></span>
=Sample for “Submit” button in English and French=
=「送信」ボタンの例(英語とフランス語)=
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
(特定のテーマと共に)すべてのアンケートの送信ボタンについて、_Submit_ではなく_Validate_を表示したいとします。テーマを更新し、gT('Submit')をgT('Validate')に置き換えると、すべての言語で常に_Validate_が表示されます。
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.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="For_all_surveys_with_all_themes"></span>
==For all surveys with all themes==
==すべてのテーマのすべてのアンケート==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
# ソースメッセージ<code>INSERT INTO lime_source_message (id, category, message) VALUES (NULL, NULL, 'Submit');</code>を作成する。
# Create the source message <code>INSERT INTO lime_source_message (id, category, message) VALUES (NULL, NULL, 'Submit');</code>
# 以下の手順で使用するため、IDを確認する(もし1番の場合:IDは1)
# Check the ID (if it's the 1st : ID is 1) and use it for next instruction
# 関連する翻訳を作成する:<code>INSERT INTO lime_message (id, language, translation) VALUES ('1', 'en', 'Validate'), ('1', 'fr', 'Valider'); </code>
# Create the related translation : <code>INSERT INTO lime_message (id, language, translation) VALUES ('1', 'en', 'Validate'), ('1', 'fr', 'Valider'); </code>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Using_your_own_theme_(recommended_solution)"></span>
==Using your own theme (recommended solution)==
==独自のテーマの使用(推奨)==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
この方法は、独自のテンプレートを使用した解決方法であり、他のすべての言語の既定文字列も更新されます。
This method uses a solution with your own template, it updates the default string for all other languages as well.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
# [[Theme editor/ja|テーマエディター]]のナビゲーションパートを選択する
# In [[Theme editor]] select the Navigation part
# <code>{{ gT("Submit") }}</code>を検索する(navigator.twig内)
# Search for <code>{{ gT("Submit") }}</code> (in navigator.twig)
# <code>{{ gT("Validate") }}</code>に置き換える
# Replace by <code>{{ gT("Validate") }}</code>
# ソースメッセージを作成する:<code>INSERT INTO lime_source_message (id, category, message) VALUES (NULL, NULL, 'Validate');</code>
# Create the source message <code>INSERT INTO lime_source_message (id, category, message) VALUES (NULL, NULL, 'Validate');</code>
# 以下の手順で使用するため、IDを確認する(もし1番の場合:IDは1)
# Check the ID (if it's the 1st : ID is 1) and use it for next instruction
# 関連する翻訳を作成する:<code>INSERT INTO lime_message (id, language, translation) VALUES ('1', 'fr', 'Valider'); </code>
# Create the related translation : <code>INSERT INTO lime_message (id, language, translation) VALUES ('1', 'fr', 'Valider'); </code>
</div>

Latest revision as of 11:31, 25 May 2024

Other languages:

はじめに

LimeSurvey 5.4.0以降では、データベースへの直接アクセスによって全言語のあらゆる文字列を独自に翻訳することができます。

既存の翻訳がビジネスニーズに適合しない場合にこのしくみを使用することができます。

LimeSurveyの中核部分のテキストを変更すると、データベースを変更する必要があるため、特定の場合にのみ使用してください。

さらに、このしくみを使用すれば、アンケートテーマ固有の文字列を翻訳することもできます。

データベース翻訳のしくみ

データベースの翻訳は、LimeSurveyはYiiフレームワークのCDbMessageSourceから着想を得た方法を使用しています。

  1. SourceMessageテーブルのlime_source_message->messageで文字列を検索し、lime_source_message->idからidを取得します。
  2. 存在する場合、対象のid lime_message->idを持つ言語lime_message->languageのMessageテーブルの関連する翻訳 lime_message->translationを検索します。

LimeSurveyは、poファイルから翻訳の配列を作成し(このファイルの更新方法についてはLimeSurveyの翻訳を参照してください)、その後、データベースのすべての翻訳とマージします。

データベースに翻訳がある場合、常にその翻訳が返されます。

「送信」ボタンの例(英語とフランス語)

(特定のテーマと共に)すべてのアンケートの送信ボタンについて、_Submit_ではなく_Validate_を表示したいとします。テーマを更新し、gT('Submit')をgT('Validate')に置き換えると、すべての言語で常に_Validate_が表示されます。

すべてのテーマのすべてのアンケート

  1. ソースメッセージINSERT INTO lime_source_message (id, category, message) VALUES (NULL, NULL, 'Submit');を作成する。
  2. 以下の手順で使用するため、IDを確認する(もし1番の場合:IDは1)
  3. 関連する翻訳を作成する:INSERT INTO lime_message (id, language, translation) VALUES ('1', 'en', 'Validate'), ('1', 'fr', 'Valider');

独自のテーマの使用(推奨)

この方法は、独自のテンプレートを使用した解決方法であり、他のすべての言語の既定文字列も更新されます。

  1. テーマエディターのナビゲーションパートを選択する
  2. Template:GT("Submit")を検索する(navigator.twig内)
  3. Template:GT("Validate")に置き換える
  4. ソースメッセージを作成する:INSERT INTO lime_source_message (id, category, message) VALUES (NULL, NULL, 'Validate');
  5. 以下の手順で使用するため、IDを確認する(もし1番の場合:IDは1)
  6. 関連する翻訳を作成する:INSERT INTO lime_message (id, language, translation) VALUES ('1', 'fr', 'Valider');