russian translate (#962)

add support internalization and russian translate.
This commit is contained in:
dodther 2023-03-21 20:20:23 +10:00 committed by GitHub
parent a55be34bc0
commit a14ef95fb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 124 additions and 43 deletions

View File

@ -1,44 +1,44 @@
<script type="text/html" data-template-name="sunrise">
<div class="form-row">
<label for="node-input-lat"><i class="fa fa-globe"></i> Latitude</label>
<input type="text" id="node-input-lat" placeholder="51.025">
</div>
<div class="form-row">
<label for="node-input-lon"><i class="fa fa-globe"></i> Longitude</label>
<input type="text" id="node-input-lon" placeholder="-1.4">
</div>
<div class="form-row">
<label for="node-input-start"><i class="fa fa-clock-o"></i> Start</label>
<select id="node-input-start" style='width:70%'>
<option value="nightEnd">Morning astronomical twilight starts</option>
<option value="nauticalDawn">Morning nautical twilight starts</option>
<option value="dawn">Dawn, morning civil twilight starts</option>
<option value="sunrise">Sunrise</option>
<option value="sunriseEnd">Sunrise end</option>
<option value="goldenHourEnd">End of morning golden hour</option>
</select>
</div>
<div class="form-row">
<label for="node-input-end"><i class="fa fa-clock-o"></i> End</label>
<select id="node-input-end" style='width:70%'>
<option value="goldenHour">Start of evening golden hour</option>
<option value="sunsetStart">Sunset start</option>
<option value="sunset">Sunset, civil twilight starts</option>
<option value="dusk">Dusk, Evening astronomical twilight starts</option>
<option value="nauticalDusk">Evening nautical twilight starts</option>
<option value="night">Dark enough for astronomy</option>
</select>
</div>
<div class="form-row">
<label><i class="fa fa-arrows-h"></i> Offset</label>
<span style="margin-right:4px">start</span> <input type="text" id="node-input-soff" placeholder="minutes" style='width:60px;'> mins
<span style="margin-left:14px; margin-right:4px">end</span> <input type="text" id="node-input-eoff" placeholder="minutes" style='width:60px;'> mins
</div>
<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">
</div>
<div class="form-row">
<label for="node-input-lat"><i class="fa fa-globe"></i><span data-i18n="sunrise.label.latitude"></span></label>
<input type="text" id="node-input-lat" placeholder="51.025">
</div>
<div class="form-row">
<label for="node-input-lon"><i class="fa fa-globe"></i><span data-i18n="sunrise.label.longitude"></span></label>
<input type="text" id="node-input-lon" placeholder="-1.4">
</div>
<div class="form-row">
<label for="node-input-start"><i class="fa fa-clock-o"></i><span data-i18n="sunrise.label.start"></label>
<select id="node-input-start" style='width:70%'>
<option value="nightEnd" data-i18n="sunrise.nightEnd"></option>
<option value="nauticalDawn" data-i18n="sunrise.nauticalDawn"></option>
<option value="dawn" data-i18n="sunrise.dawn"></option>
<option value="sunrise" data-i18n="sunrise.sunrise"></option>
<option value="sunriseEnd" data-i18n="sunrise.sunriseEnd"></option>
<option value="goldenHourEnd" data-i18n="sunrise.goldenHourEnd"></option>
</select>
</div>
<div class="form-row">
<label for="node-input-end"><i class="fa fa-clock-o"></i><span data-i18n="sunrise.label.end"></label>
<select id="node-input-end" style='width:70%'>
<option value="goldenHour" data-i18n="sunrise.goldenHour"></option>
<option value="sunsetStart" data-i18n="sunrise.sunsetStart"></option>
<option value="sunset" data-i18n="sunrise.sunset"></option>
<option value="dusk" data-i18n="sunrise.dusk"></option>
<option value="nauticalDusk" data-i18n="sunrise.nauticalDusk"></option>
<option value="night" data-i18n="sunrise.night"></option>
</select>
</div>
<div class="form-row">
<label><i class="fa fa-arrows-h"></i><span data-i18n="sunrise.label.offset"></label>
<span style="margin-right:4px" data-i18n="sunrise.start"></span> <input type="text" id="node-input-soff" placeholder="minutes" style='width:60px;' > <span data-i18n="sunrise.mins"></span>
<span style="margin-left:14px; margin-right:4px" data-i18n="sunrise.end"></span> <input type="text" id="node-input-eoff" placeholder="minutes" style='width:60px;'><span data-i18n="sunrise.mins"></span>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i><span data-i18n="sunrise.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]sunrise.label.name">
</div>
</script>
<script type="text/javascript">
@ -56,10 +56,15 @@
},
inputs:0,
outputs:2,
outputLabels: ["once per minute","only on change"],
outputLabels: function(i) {
return [
this._("sunrise.onePerMin"),
this._("sunrise.onse")
][i];
},
icon: "sun.png",
label: function() {
return this.name||"Sun rise/set";
return this.name||this._("sunrise.sunName");
},
labelStyle: function() {
return this.name?"node_label_italic":"";

View File

@ -49,8 +49,8 @@ module.exports = function(RED) {
var msg = {payload:0, topic:"sun", sun:sun, moon:moon, start:s1, end:s2, now:now};
if ((e1 > 0) & (e2 < 0)) { msg.payload = 1; }
if (oldval == null) { oldval = msg.payload; }
if (msg.payload == 1) { node.status({fill:"yellow",shape:"dot",text:"day"}); }
else { node.status({fill:"blue",shape:"dot",text:"night"}); }
if (msg.payload == 1) { node.status({fill:"yellow",shape:"dot",text:"sunrise.dayState"}); }
else { node.status({fill:"blue",shape:"dot",text:"sunrise.nightState"}); }
if (msg.payload != oldval) {
oldval = msg.payload;
node.send([msg,msg]);

View File

@ -0,0 +1,32 @@
{
"sunrise": {
"label": {
"latitude": " Latitude",
"longitude": " Longitude",
"start": " Start",
"end": " End",
"offset": " Offset",
"name": " Name"
},
"nightEnd": "Morning astronomical twilight starts",
"nauticalDawn": "Morning nautical twilight starts",
"dawn": "Dawn, morning civil twilight starts",
"sunrise": "Sunrise",
"sunriseEnd": "Sunrise end",
"goldenHourEnd": "End of morning golden hour",
"goldenHour": "Start of evening golden hour",
"sunsetStart": "Sunset start",
"sunset": "Sunset, civil twilight starts",
"dusk": "Dusk, Evening astronomical twilight starts",
"nauticalDusk": "Evening nautical twilight starts",
"night": "Dark enough for astronomy",
"start": " start",
"mins": " mins",
"end": " end",
"dayState": "day",
"nightState": "night",
"onePerMin": "once per minute",
"onse": "only on change",
"sunName": "Sun rise/set"
}
}

View File

@ -0,0 +1,11 @@
<script type="text/html" data-help-name="sunrise">
<p>Использует модуль suncalc для вывода данных о восходе и закате солнца в зависимости от указанного местоположения.</p>
<p>Доступно несколько вариантов определения восхода и захода солнца, подробности смотрите в модуле <i><a href = "https://github.com/mourner/suncalc" target="_new">suncalc</a></i>.</p>
<p> Время начала и окончания может быть смещено на несколько минут до (минус) или после (плюс) выбранного события.</p>
<p>Первый выход отправляет каждую минуту <code>msg.payload</code> <i>1</i> или <i>0</i> в зависимости от того, находится ли он между выбранными событиями или нет.
Второй выход отправляет только при переходе от ночи к дню (<i>-> 1</i>) или от дня к ночи (<i>-> 0</i>).</p>
<p>Так же выводит <code>msg.start</code>, <code>msg.end</code> и <code>msg.now</code> в формате ISO. Которые содержат время начала, окончания события на сегоднящний день с поправкой на указанное смещение, а так же текущее время.</p>
<p><code>msg.sun</code> — это содержит азимут и высоту в градусах текущего положения солнца.</p>
<p><code>msg.moon</code> — это содержит <thead></thead> положение, фазу, освещение и значок луны.</p>
</script>

View File

@ -0,0 +1,33 @@
{
"sunrise": {
"label": {
"latitude": " Широта",
"longitude": " Долгота",
"start": " Начало",
"end": " Окончание",
"offset": " Смещение",
"name": " Имя"
},
"nightEnd": "Утренние астрономические сумерки",
"nauticalDawn": "Утренние навигационные сумерки",
"dawn": "Рассвет, утренние гражданские сумерки",
"sunrise": "Восход",
"sunriseEnd": "Восход закончился",
"goldenHourEnd": "Окончание утреннего золотого часа",
"goldenHour": "Начало вечернего золотого часа",
"sunsetStart": "Начало заката",
"sunset": "Закат, начинаются вечерние гражданские сумерки",
"dusk": "Смеркается, начинаются вечерние астрономические сумерки",
"nauticalDusk": "Начинаются вечерние морские сумерки",
"night": "Достаточно темно для астрономии",
"start": " начало",
"mins": " мин",
"end": " конец",
"dayState": "день",
"nightState": "ночь",
"onePerMin": "раз в минуту",
"onse": "по событию",
"sunName": "Рассвет/закат"
}
}