add zn-CN translation for nodes:common,function,storage

This commit is contained in:
JIYE YU
2020-01-28 13:39:41 +09:00
parent 504d13943d
commit 7ffd37d9cb
18 changed files with 658 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="function">
<p>定义对接收到的消息进行处理的JavaScript代码函数的主体</p>
<p>输入消息在名为<code>msg</code>JavaScript</p>
<p>通常<code>msg</code><code>msg.payload</code></p>
<p>该函数一般会返回一个消息对象或多个消息对象但也可以为了停止流而什么都不返回</p>
<h3>详细</h3>
<p>请参见<a target="_blank" href="http://nodered.org/docs/writing-functions.html">在线文档</a></p>
<h4>传送消息</h4>
<p>要将消息传递到流中的下一个节点请返回消息或调用<code>node.send(messages)</code></p>
<p>它将返回/send:</p>
<ul>
<li>单个消息对象 - 传递给连接到第一个输出的节点</li>
<li>消息对象数组传递给连接到相应输出的节点</li>
</ul>
<p>如果数组元素是数组则将多个消息发送到相应的输出</p>
<p>无论return方法是单个值还是数组元素如果返回值为null则不会发送任何消息</p>
<h4>日志输出和错误处理</h4>
<p>使用以下功能输出日志信息和输出错误</p>
<ul>
<li><code>node.log("Log message")</code></li>
<li><code>node.warn("Warning")</code></li>
<li><code>node.error("Error")</code></li>
</ul>
</p>
<p>使用catch节点可以进行错误处理 要由catch节点处理请将<code>msg</code><code>node.error</code></p>
<pre>node.error("Error",msg);</pre>
<h4>访问节点信息</h4>
<p>您可以使用以下属性来在代码中引用节点ID和名称</p>
<ul>
<li><code>node.id</code> - ID</li>
<li><code>node.name</code> - </li>
</ul>
<h4>使用环境变量</h4>
<p>环境变量可以通过<code>env.get("MY_ENV_VAR")</code>访</p>
</script>

View File

@@ -0,0 +1,37 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="switch">
<p>按属性值来分配消息的传送路线</p>
<h3>详细</h3>
<p>根据接收到的消息评估指定的规则然后将消息发送到与匹配的规则相对应的输出端口</p>
<p>可以将节点设置为一旦发现一个匹配的规则则停止后续的匹配</p>
<p>对于评估规则可以使用消息属性流上下文/全局上下文属性环境变量和JSONata表达式的评估结果</p>
<h4>规则</h4>
<p>有四种规则</p>
<ol>
<li><b></b></li>
<li><b>顺序</b></li>
<li><b>JSONata表达式</b></li>
<li><b>其他</b></li>
</ol>
<h4>注释</h4>
<p><code>is true/false</code><code>is null</code> </p>
<p><code>is empty</code><code>null</code><code>undefined</code></p>
<h4>处理消息序列</h4>
<p>默认情况下节点不会修改<code>msg.parts</code></p>
<p>可以启用<b>重建消息序列</b><code>nodeMessageBufferMaxLength</code></p>
</script>

View File

@@ -0,0 +1,33 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="change">
<p>设置更改删除或移动消息流上下文或全局上下文的属性</p>
<p>如果指定了多个规则则将按定义的顺序来应用它们</p>
<h3>详细</h3>
<p>可用的操作有</p>
<dl class="message-properties">
<dt>设置</dt>
<dd>设置一个属性该值可以是多种不同类型也可以从现有消息或上下文属性中获取</dd>
<dt>置换</dt>
<dd>搜索并替换属性 如果启用了正则表达式则可以为replace with属性指定捕获组例如<code>$1</code> </dd>
<dt>删除</dt>
<dd>删除一个属性</dd>
<dt>移动</dt>
<dd>移动或者重命名一个属性</dd>
</dl>
<p>类型"expression"使用<a href="http://jsonata.org/" target="_new">JSONata</a></p>
</script>

View File

@@ -0,0 +1,40 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="range">
<p>将数值映射为另一个区间的数值</p>
<h3>输入</h3>
<dl class="message-properties">
<dt>payload<span class="property-type">数值</span></dt>
<dd>payload<i>一定</i>. </dd>
</dl>
<h3>输出</h3>
<dl class="message-properties">
<dt>payload<span class="property-type">数值</span></dt>
<dd>被映射到新区间的数值</dd>
</dl>
<h3>详细</h3>
<p>该节点将线性缩放所接收到的数值在默认情况下结果不限于节点中定义的范围</p>
<p><i>缩放并限制到目标范围</i></p>
<p><i>在目标范围内缩放并折叠</i></p>
<p>例如输入0-10映射到0-100</p>
<table style="outline-width:#888 solid thin">
<tr><th width="80px">模式</th><th width="80px"></th><th width="80px"></th></tr>
<tr><td><center>scale</center></td><td><center>12</center></td><td><center>120</center></td></tr>
<tr><td><center>limit</center></td><td><center>12</center></td><td><center>100</center></td></tr>
<tr><td><center>wrap</center></td><td><center>12</center></td><td><center>20</center></td></tr>
</table>
</script>

View File

@@ -0,0 +1,46 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="template">
<p>根据提供的模板设置属性</p>
<h3>输入</h3>
<dl class="message-properties">
<dt>msg <span class="property-type">object</span></dt>
<dd>一个msg对象其中包含着用于填充模板的信息</dd>
<dt class="optional">template <span class="property-type">string</span></dt>
<dd><code>msg.payload</code>msg</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>msg <span class="property-type">object</span></dt>
<dd>由来自传入msg的属性来填充已配置的模板后输出的带有属性的msg</dd>
</dl>
<h3>详细</h3>
<p>默认情况下使用<i><a href="http://mustache.github.io/mustache.5.html" target="_blank">mustache</a></i>格式如有需要也可以切换其他格式</p>
<p>例如:
<pre>Hello {{payload.name}}. Today is {{date}}</pre>
<p>receives a message containing:
<pre>{
date: "Monday",
payload: {
name: "Fred"
}
}</pre>
<p>输出的消息将会是:
<pre>Hello Fred. Today is Monday</pre>
<p>也可以使用流上下文或全局上下文中的属性<code>{{flow.name}}</code><code>{{global.name}}</code><code>store</code>使<code>{{flow[store].name}}</code><code>{{global[store].name}}</code>
<p><b>注意</b>默认情况下,<i>mustache</i>将在其替换的值中转义任何非字母数字或HTML实体为了防止这种情况请使用<code>{{{triple}}}</code>
</script>

View File

@@ -0,0 +1,32 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="delay">
<p>对通过节点的消息进行延迟发送或限制</p>
<h3>输入</h3>
<dl class="message-properties">
<dt class="optional">delay <span class="property-type">数值</span></dt>
<dd>设置要应用于消息的延迟以毫秒为单位仅当节点配置为允许消息去覆盖配置的默认延迟间隔时此选项才适用</dd>
<dt class="optional">reset</dt>
<dd>如果接收到的消息将此属性设置为任何值则将清空该节点保留的所有的未发送消息</dd>
<dt class="optional">flush</dt>
<dd>如果接收到的消息的此属性设置为任何值则将立即发送该节点保留的所有未发送消息</dd>
</dl>
<h3>详细</h3>
<p>当配置为延迟发送消息时延迟间隔可以是一个固定值一个范围内的随机值或为每个消息动态设置</p>
<p>当配置为对消息进行限制时它们的传递将分散在配置的时间段内状态显示队列中当前的消息数可以选择在中间消息到达时丢弃它们</p>
<p>速率限制可以应用于所有消息也可以根据<code>msg.topic</code></p>
</script>

View File

@@ -0,0 +1,33 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="trigger">
<p>触发后将会发送一条消息如果被拓展或重置则可以选择发送第二条消息</p>
<h3>输入</h3>
<dl class="message-properties">
<dt class="optional">reset</dt>
<dd>如果收到带有此属性的消息则将清除当前正在进行的任何超时或重复且不会触发任何消息</dd>
</dl>
<h3>详细</h3>
<p>该节点可用于在流中创建一个超时 默认情况下当它收到一条消息时它将发送一条带有<code>1</code>payload250payload<code>0</code>使Raspberry Pi GPIOLED</p>
<p>可以将发送的每个消息的payload配置为各种值包括不发送任何内容的选项例如将初始消息设置为<i>nothing</i></p>
<p>如果设置为<i>字符串</i>类型,则该节点支持<i>mustache</i>模板语法</p>
<p>如果节点收到具有<code>reset</code><code>payload</code></p>
<p>可以将节点配置为以固定的时间间隔重新发送消息直到被收到的消息重置为止</p>
<p>可选可以将节点配置为将带有<code>msg.topic</code></p>
</script>

View File

@@ -0,0 +1,74 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-help-name="exec">
<p>运行系统命令并返回其输出</p>
<p>可以将节点配置为等待命令完成或者在命令生成时发送其输出</p>
<p>运行的命令可以在节点中配置也可以由收到的消息提供</p>
<h3>输入</h3>
<dl class="message-properties">
<dt class="optional">payload <span class="property-type">字符串</span></dt>
<dd>如果这样配置则将被附加到执行命令中</dd>
<dt class="optional">kill <span class="property-type">字符串</span></dt>
<dd>指定发送到现有的exec节点进程的kill信号类型</dd>
<dt class="optional">pid <span class="property-type">数值|字符串</span></dt>
<dd>要杀死的现有exec节点进程的进程ID</dd>
</dl>
<h3>输出</h3>
<ol class="node-ports">
<li>标准输出(stdout)
<dl class="message-properties">
<dt>payload <span class="property-type">字符串</span></dt>
<dd>命令的标准输出</dd>
</dl>
<dl class="message-properties">
<dt>rc <span class="property-type">object</span></dt>
<dd>仅执行模式一个返回代码对象的副本在端口3上也可用</dd>
</dl>
</li>
<li>标准error输出(stderr)
<dl class="message-properties">
<dt>payload <span class="property-type">字符串</span></dt>
<dd>命令的标准错误输出</dd>
</dl>
<dl class="message-properties">
<dt>rc <span class="property-type">object</span></dt>
<dd>仅执行模式一个返回代码对象的副本在端口3上也可用</dd>
</dl>
</li>
<li>返回代码
<dl class="message-properties">
<dt>payload <span class="property-type">object</span></dt>
<dd>一个包含返回代码以及<code>message</code><code>signal</code></dd>
</dl>
</li>
</ol>
<h3>详细</h3>
<p>默认情况下使用<code>exec</code><code>{code0}</code></p>
<p>可选可以选择使用<code>spawn</code>stdoutstderr<code>{code0}</code></p>
<p>错误可能会在第三个端口<code>msg.payload</code><code>message</code><code>signal</code></p>
<p>运行的命令是在节点内定义的带有附加<code>msg.payload</code></p>
<p>带空格的命令或参数应该用引号引起来<code>这是一个参数</code></p>
<p>返回的<code>payload</code>通常是<i>字符串</i>类型除非检测到非UTF8字符在这种情况下它会是<i>buffer</i></p>
<p>节点处于活动状态时该节点的状态图标和PID将可见对此更改可以通过<code>Status</code></p>
<h4>杀死进程</h4>
<p>发送<code>msg.kill</code><code>msg.kill</code><code>SIGINT</code><code>SIGQUIT</code><code>SIGHUP</code><code>SIGTERM</code></p>
<p>如果节点有多个进程在运行则还必须设置<code>msg.pid</code>PID</p>
<p>如果<code>Timeout</code></p>
<p>提示如果运行Python应用程序则可能需要使用<code>-u</code></p>
</script>