Add Japanese translations for sqlite node (#725)

* Add Japanese translations for sqlite node

* Improve Japanese translations for sqlite node

* Restructure message catalog
This commit is contained in:
Kazuhito Yokoi 2020-12-17 17:26:32 +09:00 committed by GitHub
parent cbcb3036be
commit fa2ea96e67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 109 additions and 47 deletions

View File

@ -0,0 +1,28 @@
<script type="text/html" data-help-name="sqlite">
<p>Allows access to a SQLite database.</p>
<p>SQL Query sets how the query is passed to the node.</p>
<p>SQL Query <i>Via msg.topic</i> and <i>Fixed Statement</i> uses the <b>db.all</b> operation against the configured database. This does allow INSERTS, UPDATES and DELETES.
By its very nature it is SQL injection... so <i>be careful out there...</i></p>
<p>SQL Type <i>Prepared Statement</i> also uses <b>db.all</b> but sanitizes parameters passed, eliminating the possibility of SQL injection.</p>
<p>SQL Type <i>Batch without response</i> uses <b>db.exec</b> which runs all SQL statements in the provided string. No result rows are returned.</p>
<p>When using <i>Via msg.topic</i> or <i>Batch without response</i> <code>msg.topic</code> must hold the <i>query</i> for the database.</p>
<p>When using Normal or Prepared Statement, the <i>query</i> must be entered in the node config.</p>
<p>Pass in the parameters as an object in <code>msg.params</code> for Prepared Statement. Ex:<br />
<code>msg.params = {<br />
&nbsp;&nbsp;&nbsp;&nbsp;$id:1,<br />
&nbsp;&nbsp;&nbsp;&nbsp;$name:"John Doe"<br />
}</code><br />
Parameter object names must match parameters set up in the Prepared Statement. If you get the error <code>SQLITE_RANGE: bind or column index out of range</code>
be sure to include $ on the parameter object key.<br />
The SQL query for the example above could be: <code>insert into user_table (user_id, user) VALUES ($id, $name);</code></p>
<p>Using any SQL Query, the result is returned in <code>msg.payload</code></p>
<p>Typically the returned payload will be an array of the result rows, (or an error).</p>
<p>You can load SQLite extensions by inputting a <code>msg.extension</code> property containing the full
path and filename.</p>
<p>The reconnect timeout in milliseconds can be changed by adding a line to <b>settings.js</b>
<pre>sqliteReconnectTime: 20000,</pre></p>
</script>
<script type="text/html" data-help-name="sqlitedb">
<p>The default directory for the database file is the user's home directory through which the Node-RED process was started. You can specify absolute path to change it.</p>
</script>

View File

@ -0,0 +1,20 @@
{
"sqlite": {
"label": {
"database": "Database",
"sqlQuery": "SQL Query",
"viaMsgTopic": "Via msg.topic",
"fixedStatement": "Fixed Statement",
"preparedStatement": "Prepared Statement",
"batchWithoutResponse": "Batch without response",
"sqlStatement": "SQL Statement",
"mode": "Mode",
"readWriteCreate": "Read-Write-Create",
"readWrite": "Read-Write",
"readOnly": "Read-Only"
},
"tips": {
"memoryDb": "<b>Note</b>: Setting the database name to <code>:memory:</code> will create a non-persistant in memory database."
}
}
}

View File

@ -0,0 +1,26 @@
<script type="text/html" data-help-name="sqlite">
<p>SQLiteデータベースにアクセスする機能を提供します。</p>
<p>SQLクエリには、本ードへどの様にクエリを渡すかを設定します。</p>
<p><i>msg.topic経由</i><i>固定文</i> のSQLクエリは、設定したデータベースに対して <b>db.all</b> 操作を実行します。これによって、INSERTSとUPDATES、DELETESを利用できます。性質上、SQLインジェクションに<i>注意してください</i></p>
<p><i>事前定義文</i> のSQLタイプも <b>db.all</b> を使用しますが、渡されたパラメータを無害化することで、SQLインジェクションが生じる可能性を排除できます。</p>
<p><i>一括(応答なし)</i> のSQLタイプは、提供された文字列内にある全てのSQLステートメントを実行する <b>db.exec</b> を使用します。結果の行は返されません。</p>
<p><i>msg.topic経由</i> または <i>一括(応答なし)</i> を用いる時、 <code>msg.topic</code> には、データベースに問い合わせるための <i>クエリ</i> が格納されている必要があります。</p>
<p>通常の方法や事前定義文を用いる時、 <i>クエリ</i> はノード設定に入力される必要があります。</p>
<p>事前定義文を用いるためには <code>msg.params</code> をオブジェクトとしてパラメータに渡します。例:<br />
<code>msg.params = {<br />
&nbsp;&nbsp;&nbsp;&nbsp;$id:1,<br />
&nbsp;&nbsp;&nbsp;&nbsp;$name:"John Doe"<br />
}</code><br />
パラメータのオブジェクト名は、事前定義文に設定したパラメータと一致させる必要があります。
もし <code>SQLITE_RANGE: bind or column index out of range</code> というエラーが発生した場合は、バラメータのオブジェクトのキーに$を含めてください。<br />
上の例で用いるSQLクエリは、次の様になります: <code>insert into user_table (user_id, user) VALUES ($id, $name);</code></p>
<p>SQLクエリを使用すると、 <code>msg.payload</code> に結果が返されます。</p>
<p>通常、返されるペイロードは、結果の行から成る配列(またはエラー)になります。</p>
<p>フルパスやファイル名を含む <code>msg.extension</code> プロパティを用いることで、SQLiteの拡張を読み込むこともできます。</p>
<p>ミリ秒単位の再接続タイムアウトは、<b>settings.js</b> に下記の設定を追加することで、変更できます。
<pre>sqliteReconnectTime: 20000,</pre></p>
</script>
<script type="text/html" data-help-name="sqlitedb">
<p>データベースファイルのデフォルトディレクトリは、Node-REDプロセスを開始したユーザのホームディレクトリです。これは絶対パスを用いることで変更できます。</p>
</script>

View File

@ -0,0 +1,20 @@
{
"sqlite": {
"label": {
"database": "データベース",
"sqlQuery": "SQLクエリ",
"viaMsgTopic": "msg.topic経由",
"fixedStatement": "固定文",
"preparedStatement": "事前定義文",
"batchWithoutResponse": "一括(応答なし)",
"sqlStatement": "SQL文",
"mode": "モード",
"readWriteCreate": "読み取り-書き込み-作成",
"readWrite": "読み取り-書き込み",
"readOnly": "読み取りのみ"
},
"tips": {
"memoryDb": "<b>注釈</b>: データベース名に <code>:memory:</code> を設定すると、非永続的なメモリデータベースを作成します。"
}
}
}

View File

@ -1,19 +1,17 @@
<script type="text/html" data-template-name="sqlitedb">
<div class="form-row">
<label for="node-config-input-db"><i class="fa fa-database"></i> Database</label>
<label for="node-config-input-db"><i class="fa fa-database"></i> <span data-i18n="sqlite.label.database"></label>
<input type="text" id="node-config-input-db" placeholder="/tmp/sqlite">
</div>
<div class="form-row">
<label for="node-config-input-mode">Mode</label>
<label for="node-config-input-mode" data-i18n="sqlite.label.mode"></label>
<select id="node-config-input-mode" style="width:70%">
<option value="RWC">Read-Write-Create</option>
<option value="RW">Read-Write</option>
<option value="RO">Read-Only</option>
<option value="RWC" data-i18n="sqlite.label.readWriteCreate"></option>
<option value="RW" data-i18n="sqlite.label.readWrite"></option>
<option value="RO" data-i18n="sqlite.label.readOnly"></option>
</select>
</div>
<div class="form-tips"><b>Note</b>: Setting the database name to <code>:memory:</code>
will create a non-persistant in memory database.</div>
<div class="form-tips" data-i18n="[html]sqlite.tips.memoryDb"></div>
</script>
<script type="text/javascript">
@ -29,27 +27,26 @@
});
</script>
<script type="text/html" data-template-name="sqlite">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
<div class="form-row">
<label for="node-input-mydb"><i class="fa fa-database"></i> Database</label>
<label for="node-input-mydb"><i class="fa fa-database"></i> <span data-i18n="sqlite.label.database"></label>
<input type="text" id="node-input-mydb">
</div>
<div class="form-row">
<label for=""><i class="fa fa-code"></i> SQL Query</label>
<label for=""><i class="fa fa-code"></i> <span data-i18n="sqlite.label.sqlQuery"></label>
<select id="node-input-sqlquery">
<option value="msg.topic">Via msg.topic</option>
<option value="fixed">Fixed Statement</option>
<option value="prepared">Prepared Statement</option>
<option value="batch">Batch without response</option>
<option value="msg.topic" data-i18n="sqlite.label.viaMsgTopic"></option>
<option value="fixed" data-i18n="sqlite.label.fixedStatement"></option>
<option value="prepared" data-i18n="sqlite.label.preparedStatement"></option>
<option value="batch" data-i18n="sqlite.label.batchWithoutResponse"></option>
</select>
</div>
<div class="form-row" style="margin-bottom: 0px;">
<label for="" style="width: unset;" id="node-input-sqllabel"><i class="fa fa-code"></i> SQL Statement</label>
<label for="" style="width: unset;" id="node-input-sqllabel"><i class="fa fa-code"></i> <span data-i18n="sqlite.label.sqlStatement"></label>
</div>
<div>
<input type="hidden" id="node-input-sql" autofocus="autofocus">
@ -59,35 +56,6 @@
</div>
</script>
<script type="text/html" data-help-name="sqlite">
<p>Allows access to a Sqlite database.</p>
<p>SQL Query sets how the query is passed to the node.</p>
<p>SQL Query <i>Via msg.topic</i> and <i>Fixed Statement</i> uses the <b>db.all</b> operation against the configured database. This does allow INSERTS, UPDATES and DELETES.
By its very nature it is SQL injection... so <i>be careful out there...</i></p>
<p>SQL Type <i>Prepared Statement</i> also uses <b>db.all</b> but sanitizes parameters passed, eliminating the possibility of SQL injection.</p>
<p>SQL Type <i>Batch without response</i> uses <b>db.exec</b> which runs all SQL statements in the provided string. No result rows are returned.</p>
<p>When using <i>Via msg.topic</i> or <i>Batch without response</i> <code>msg.topic</code> must hold the <i>query</i> for the database.</p>
<p>When using Normal or Prepared the <i>query</i> must be entered in the node config.</p>
<p>Pass in the parameters as an object in <code>msg.params</code> for Prepared. Ex:<br />
<code>msg.params = {<br />
&nbsp;&nbsp;&nbsp;&nbsp;$id:1,<br />
&nbsp;&nbsp;&nbsp;&nbsp;$name:"John Doe"<br />
}</code><br />
Parameter object names must match parameters set up in the Prepared Statement. If you get the error <code>SQLITE_RANGE: bind or column index out of range</code>
be sure to include $ on the parameter object key.<br />
The sql query for the example above could be: <code>insert into user_table (user_id, user) VALUES ($id, $name);</code></p>
<p>Using any SQL Query, the result is returned in <code>msg.payload</code></p>
<p>Typically the returned payload will be an array of the result rows, (or an error).</p>
<p>You can load sqlite extensions by inputting a <code>msg.extension</code> property containing the full
path and filename.</p>
<p>The reconnect timeout in milliseconds can be changed by adding a line to <b>settings.js</b>
<pre>sqliteReconnectTime: 20000,</pre></p>
</script>
<script type="text/html" data-help-name="sqlitedb">
<p>The default directory for the database file is the user's home directory through which the NR process was started. You can specify absolute path to change it.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('sqlite',{
category: 'storage-input',