more russian google translate, fallback to english

This commit is contained in:
Martti Malmi 2020-05-25 22:44:58 +03:00
parent a14121b611
commit 2642b9137f
3 changed files with 54 additions and 19 deletions

View File

@ -73,10 +73,10 @@
</div> </div>
</form> </form>
<div id="existing-account-login" class="hidden"> <div id="existing-account-login" class="hidden">
<p><a href="#" id="show-create-account">&lt; Back</a></p> <p><a href="#" id="show-create-account">&lt; <%= back %></a></p>
<input id="paste-privkey" placeholder="Paste a private key"> <input id="paste-privkey" placeholder="<%= paste_private_key %>">
<p> <p>
<button id="scan-privkey-btn">Scan private key QR code</button> <button id="scan-privkey-btn"><%= scan_private_key_qr_code %></button>
</p> </p>
</p> </p>
<video id="privkey-qr-video" width="320" height="320" style="object-fit: cover;" class="hidden"></video> <video id="privkey-qr-video" width="320" height="320" style="object-fit: cover;" class="hidden"></video>
@ -91,8 +91,8 @@
<div class="user-name"></div> <div class="user-name"></div>
</div> </div>
<div id="enable-notifications-prompt"> <div id="enable-notifications-prompt">
<div class="title">Get notified of new messages</div> <div class="title"><%= get_notified_new_messages %></div>
<div><a>Turn on desktop notifications</a></div> <div><a><%= turn_on_desktop_notifications %></a></div>
</div> </div>
<div class="chat-list"> <div class="chat-list">
<div class="chat-item new"> <div class="chat-item new">
@ -100,7 +100,7 @@
viewBox="0 0 510 510" xml:space="preserve"> viewBox="0 0 510 510" xml:space="preserve">
<path fill="currentColor" d="M459,0H51C22.95,0,0,22.95,0,51v459l102-102h357c28.05,0,51-22.95,51-51V51C510,22.95,487.05,0,459,0z M102,178.5h306v51 H102V178.5z M306,306H102v-51h204V306z M408,153H102v-51h306V153z"/> <path fill="currentColor" d="M459,0H51C22.95,0,0,22.95,0,51v459l102-102h357c28.05,0,51-22.95,51-51V51C510,22.95,487.05,0,459,0z M102,178.5h306v51 H102V178.5z M306,306H102v-51h204V306z M408,153H102v-51h306V153z"/>
</svg> </svg>
New chat <%= new_chat %>
</div> </div>
<div id="welcome" class="visible-xs-block"> <div id="welcome" class="visible-xs-block">
<h3>Iris Messenger</h3> <h3>Iris Messenger</h3>
@ -125,7 +125,7 @@
</div> </div>
<div id="not-seen-by-them" style="display: none"> <div id="not-seen-by-them" style="display: none">
<p>If the other person doesn't see your message, you can give them <b>your</b> chat link through some other channel:</p> <p>If the other person doesn't see your message, you can give them <b>your</b> chat link through some other channel:</p>
<p><button class="copy-chat-link">Copy your chat link</button></p> <p><button class="copy-chat-link"><%= copy_your_chat_link %></button></p>
</div> </div>
<div class="message-form" style="display:none"> <div class="message-form" style="display:none">
<form autocomplete="off"> <form autocomplete="off">
@ -145,19 +145,19 @@
<!-- New chat view --> <!-- New chat view -->
<div class="main-view" id="new-chat"> <div class="main-view" id="new-chat">
<h3>Have someone's chat link?</h3> <h3><%= have_someones_chat_link %></h3>
<input id="paste-chat-link" type="text" placeholder="Paste their chat link"> <input id="paste-chat-link" type="text" placeholder="<%= paste_their_chat_link %>">
<button id="scan-chatlink-qr-btn">Or scan their QR code</button> <button id="scan-chatlink-qr-btn"><%= or_scan_qr_code %></button>
<video id="chatlink-qr-video" width="320" height="320" style="object-fit: cover;"></video> <video id="chatlink-qr-video" width="320" height="320" style="object-fit: cover;"></video>
<h3>Give your chat link:</h3> <h3><%= give_your_chat_link %></h3>
<button class="copy-chat-link">Copy your chat link</button> <button class="copy-chat-link"><%= copy_your_chat_link %></button>
<button id="show-my-qr-btn">Or show your QR code</button> <button id="show-my-qr-btn"><%= or_show_qr_code %></button>
<p id="my-qr-code" class="qr-container" style="display:none"></p> <p id="my-qr-code" class="qr-container" style="display:none"></p>
<p><small>Beware of sharing your chat link publicly: you might get spammed with message requests. Publicly share your <a class="profile-link">profile link</a> instead.</small></p> <p><small>Beware of sharing your chat link publicly: you might get spammed with message requests. Publicly share your <a class="profile-link">profile link</a> instead.</small></p>
<h3>New group</h3> <h3><%= new_group %></h3>
<p> <p>
<input id="new-group-name" type="text" placeholder="Group name"> <input id="new-group-name" type="text" placeholder="<%= group_name %>">
<button id="new-group-create">Create</button> <button id="new-group-create"><%= create %></button>
</p> </p>
<hr/> <hr/>
<h3>Your Chat Links</h3> <h3>Your Chat Links</h3>

View File

@ -71,6 +71,11 @@ if (iris.util.isElectron) {
var AVAILABLE_LANGUAGES = Object.keys(IRIS_TRANSLATIONS); var AVAILABLE_LANGUAGES = Object.keys(IRIS_TRANSLATIONS);
var language = localStorage.getItem('language') || (navigator.language && navigator.language.slice(0,2)) || 'en'; var language = localStorage.getItem('language') || (navigator.language && navigator.language.slice(0,2)) || 'en';
language = AVAILABLE_LANGUAGES.indexOf(language) >= 0 ? language : 'en'; language = AVAILABLE_LANGUAGES.indexOf(language) >= 0 ? language : 'en';
var languageObj = IRIS_TRANSLATIONS[language];
if (language !== 'en') {
var en = IRIS_TRANSLATIONS['en'];
Object.keys(en).forEach(k => languageObj[k] = languageObj[k] || en[k]);
}
var main_content_temp = _.template($('#main-content-template').html()); var main_content_temp = _.template($('#main-content-template').html());
$('body').prepend($('<div>').attr('id', 'main-content').html(main_content_temp(IRIS_TRANSLATIONS[language]))); $('body').prepend($('<div>').attr('id', 'main-content').html(main_content_temp(IRIS_TRANSLATIONS[language])));
AVAILABLE_LANGUAGES.forEach(l => { AVAILABLE_LANGUAGES.forEach(l => {
@ -592,7 +597,7 @@ function showNewChat() {
resetView(); resetView();
$('.chat-item.new').toggleClass('active', true); $('.chat-item.new').toggleClass('active', true);
$('#new-chat').show(); $('#new-chat').show();
$("#header-content").text('New chat'); $("#header-content").text(languageObj.new_chat);
$('#show-my-qr-btn').off().click(() => { $('#show-my-qr-btn').off().click(() => {
$('#my-qr-code').toggle() $('#my-qr-code').toggle()
}) })

View File

@ -4,13 +4,43 @@ var IRIS_TRANSLATIONS = {
iris_messenger: "Iris Messenger", iris_messenger: "Iris Messenger",
whats_your_name: "What's your name?", whats_your_name: "What's your name?",
new_user_go: "Go", new_user_go: "Go",
already_have_an_account: "Already have an account?" already_have_an_account: "Already have an account?",
back: "Back",
scan_private_key_qr_code: "Scan private key QR code",
paste_private_key: "Paste a private key",
get_notified_new_messages: "Get notified of new messages",
turn_on_desktop_notifications: "Turn on desktop notifications",
new_chat: "New chat",
copy_your_chat_link: "Copy your chat link",
have_someones_chat_link: "Have someone's chat link?",
paste_their_chat_link: "Paste their chat link",
give_your_chat_link: "Give your chat link:",
or_scan_qr_code: "Or scan their QR code",
or_show_qr_code: "Or show your QR code",
new_group: "New group",
group_name: "Group name",
create: "Create",
}, },
"ru": { "ru": {
language_name: "Русский", language_name: "Русский",
iris_messenger: "Iris Messenger", iris_messenger: "Iris Messenger",
whats_your_name: "Как вас зовут?", whats_your_name: "Как вас зовут?",
new_user_go: "Вход", new_user_go: "Вход",
already_have_an_account: "Уже есть аккаунт?" already_have_an_account: "Уже есть аккаунт?",
back: "назад",
scan_private_key_qr_code: "Сканируйте QR-код",
paste_private_key: "Вставить закрытый ключ",
get_notified_new_messages: "Получать уведомления о новых сообщениях",
turn_on_desktop_notifications: "Включить уведомления на рабочем столе",
new_chat: "Новый чат",
copy_your_chat_link: "Скопируйте ссылку на чат",
have_someones_chat_link: "Есть чья-то ссылка на чат?",
paste_their_chat_link: "Вставьте их ссылку на чат",
give_your_chat_link: "Дайте ссылку на чат:",
or_scan_qr_code: "Или отсканируйте их QR-код",
or_show_qr_code: "Или покажите свой QR-код",
new_group: "Новая группа",
group_name: "Имя группы",
create: "Создайте",
} }
}; };