translate headers, button, &c.

This commit is contained in:
rm 2024-12-19 20:50:38 +00:00
parent be9dbde55b
commit 076c5e45d5

View file

@ -211,6 +211,19 @@ var current_dialog = null;
var translations = {
// Headers
'Contact': {en:'', da:'Kontakt', tok:'jan'},
'Your contacts': {en:'Your contacts', da:'Dine kontakter', tok:'jan sina'},
'status': {en:'status', da:'status', tok:'sona pi pali ilo'},
'SEND': {en:'SEND', da:'SEND', tok:'TAWA'},
// Status
'encrypting message': {en:'encrypting message', da:'besked krypteres', tok:'lipu li kama len'},
'sending message': {en:'sending message', da:'besked sendes', tok:'lipu li kama tawa'},
'message was sent': {en:'message was sent', da:'besked blev sendt', tok:'lipu li tawa pini'},
'scanning for illegal content': {en:'scanning for illegal content', da:'skannes for ulovlige indhold', tok:'alasa pi toki ike'},
'Reporting suspicious content': {en:'Reporting suspicious content', da:'mistænkelig indhold anmeldes', tok:'toki pi ike ken li tawa kulupu pi awen lawa'},
// Contact list
'Friend': {en:'Friend', da:'Ven', tok:'jan pona'},
'Mom': {en:'Mom', da:'Mor', tok:'jan mama'},
@ -800,7 +813,7 @@ function start_chat(index) {
let contact = contact_list[index];
let who = _(contact.name);
let indicator = document.getElementById('contact_indicator');
indicator.childNodes[0].data = `Contact: ${who}`;
indicator.childNodes[0].data = `${_('Contact')}: ${who}`;
removeAllChildren(document.getElementById('messages'));
swipe_viewport();
contact.dialog();
@ -816,8 +829,7 @@ function Dialog() {
return conversation_id == conversation_count;
}
async function post_message(dialog, message_en, is_myself) {
let message = _(message_en)
async function post_message(dialog, message, is_myself) {
if(!is_myself && dialog.messages.length && !message.startsWith('!')) {
await wait(message.length * get_typing_speed());
} // first message should be instant
@ -846,7 +858,8 @@ function Dialog() {
this.messages.forEach(msg => msg.shift_y_pos(this.y_shift));
}
this.me = async function(message, will_be_flagged) {
this.me = async function(en_message, will_be_flagged) {
const message = _(en_message);
await wait(30 * get_typing_speed()); // give me some time to read
if(!this.is_active()) return;
await type_message(this, message);
@ -861,7 +874,8 @@ function Dialog() {
}
}
this.you = async function(message, will_be_flagged) {
this.you = async function(en_message, will_be_flagged) {
const message = _(en_message);
await post_message(this, message, false);
if(will_be_flagged) {
await post_message(this, '!flagged', true);
@ -908,22 +922,22 @@ function clear_input_field() {
async function local_message_processing(will_be_flagged) {
let text_element = document.getElementById('message_status');
let indicator = text_element.childNodes[0];
indicator.data = 'scanning for illegal content';
indicator.data = _('scanning for illegal content');
await wait(16 * get_typing_speed());
if(will_be_flagged) {
let box = document.getElementById('message_status_box');
text_element.setAttribute('fill', 'red');
box.setAttribute('fill', 'yellow');
indicator.data = 'Reporting suspicious content';
indicator.data = _('Reporting suspicious content');
await wait(20 * get_typing_speed());
text_element.setAttribute('fill', 'white');
box.setAttribute('fill', '#FF7B00');
}
indicator.data = 'encrypting message';
indicator.data = _('encrypting message');
await wait(11 * get_typing_speed());
indicator.data = 'sending message';
indicator.data = _('sending message');
await wait(10 * get_typing_speed());
indicator.data = 'message was sent';
indicator.data = _('message was sent');
}
async function scroll_up() {
@ -1244,6 +1258,9 @@ function fill_contact_list(lang) {
group.appendChild(box);
group.appendChild(text);
}
document.getElementById('message_submit_button').textContent = _('SEND');
document.getElementById('message_status').textContent = _('status');
document.getElementById('dine_kontakter').textContent = _('Your contacts');
}
function run() {
@ -1339,7 +1356,7 @@ function run() {
<text
x="60"
y="30"
id="text84">Dine kontakter</text>
id="dine_kontakter">Dine kontakter</text>
<rect
x="0"
y="50"

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 89 KiB