Compare commits

...

3 Commits

Author SHA1 Message Date
704bbce9bb Add strings for update checker 2025-02-04 20:34:33 +01:00
29a38530a2 Add update script 2025-02-04 20:27:57 +01:00
388a884343 Normalise line endings 2025-02-04 20:20:25 +01:00
7 changed files with 208 additions and 125 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.js text eof=lf

View File

@ -1,5 +1,12 @@
// German translation by Animan8000
dict = {
checking_updates: `[UNTRANSLATED] Checking for updates...`,
update_check_fail: `[UNTRANSLATED] Failed to check for updates.`,
no_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version-full"></span>. No updates are available right now.`,
dll_to_dll_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version"></span>. This is not the latest version, but updating would require you to close the game, so don't worry about it right now.`,
dll_to_hotfix_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version"></span>. The latest hotfix for this DLL is <b class="hotfix-available"></b>. If you want, I can <a href="#" onclick="fetch('/download_latest_hotfix')">download and apply it now</a> — no restart required.`,
hotfix_to_hotfix_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version-full"></span>. The latest hotfix is <b class="hotfix-available"></b>. If you want, I can <a href="#" onclick="fetch('/download_latest_hotfix')">download and apply it now</a> — no restart required.`,
server_host: `Server-Host`,
server_host_submit: `Ändern`,
logout: `Abmelden`,

View File

@ -1,4 +1,11 @@
dict = {
checking_updates: `Checking for updates...`,
update_check_fail: `Failed to check for updates.`,
no_update: `You are running OpenWF Bootstrapper v<span class="local-version-full"></span>. No updates are available right now.`,
dll_to_dll_update: `You are running OpenWF Bootstrapper v<span class="local-version"></span>. This is not the latest version, but updating would require you to close the game, so don't worry about it right now.`,
dll_to_hotfix_update: `You are running OpenWF Bootstrapper v<span class="local-version"></span>. The latest hotfix for this DLL is <b class="hotfix-available"></b>. If you want, I can <a href="#" onclick="fetch('/download_latest_hotfix')">download and apply it now</a> — no restart required.`,
hotfix_to_hotfix_update: `You are running OpenWF Bootstrapper v<span class="local-version-full"></span>. The latest hotfix is <b class="hotfix-available"></b>. If you want, I can <a href="#" onclick="fetch('/download_latest_hotfix')">download and apply it now</a> — no restart required.`,
server_host: `Server Host`,
server_host_submit: `Change`,
logout: `Logout`,

View File

@ -1,5 +1,12 @@
// French translation by Vitruvio (zexal.)
dict = {
checking_updates: `[UNTRANSLATED] Checking for updates...`,
update_check_fail: `[UNTRANSLATED] Failed to check for updates.`,
no_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version-full"></span>. No updates are available right now.`,
dll_to_dll_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version"></span>. This is not the latest version, but updating would require you to close the game, so don't worry about it right now.`,
dll_to_hotfix_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version"></span>. The latest hotfix for this DLL is <b class="hotfix-available"></b>. If you want, I can <a href="#" onclick="fetch('/download_latest_hotfix')">download and apply it now</a> — no restart required.`,
hotfix_to_hotfix_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version-full"></span>. The latest hotfix is <b class="hotfix-available"></b>. If you want, I can <a href="#" onclick="fetch('/download_latest_hotfix')">download and apply it now</a> — no restart required.`,
server_host: `Hôte (serveur)`,
server_host_submit: `Modifier`,
logout: `Déconnexion`,

View File

@ -1,5 +1,12 @@
// Russian translation by azdful
dict = {
checking_updates: `[UNTRANSLATED] Checking for updates...`,
update_check_fail: `[UNTRANSLATED] Failed to check for updates.`,
no_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version-full"></span>. No updates are available right now.`,
dll_to_dll_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version"></span>. This is not the latest version, but updating would require you to close the game, so don't worry about it right now.`,
dll_to_hotfix_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version"></span>. The latest hotfix for this DLL is <b class="hotfix-available"></b>. If you want, I can <a href="#" onclick="fetch('/download_latest_hotfix')">download and apply it now</a> — no restart required.`,
hotfix_to_hotfix_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version-full"></span>. The latest hotfix is <b class="hotfix-available"></b>. If you want, I can <a href="#" onclick="fetch('/download_latest_hotfix')">download and apply it now</a> — no restart required.`,
server_host: `Хост Сервера`,
server_host_submit: `Изменить`,
logout: `Выход`,

View File

@ -1,5 +1,12 @@
// Chinese translation by 喜欢 (wxhn1225)
dict = {
checking_updates: `[UNTRANSLATED] Checking for updates...`,
update_check_fail: `[UNTRANSLATED] Failed to check for updates.`,
no_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version-full"></span>. No updates are available right now.`,
dll_to_dll_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version"></span>. This is not the latest version, but updating would require you to close the game, so don't worry about it right now.`,
dll_to_hotfix_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version"></span>. The latest hotfix for this DLL is <b class="hotfix-available"></b>. If you want, I can <a href="#" onclick="fetch('/download_latest_hotfix')">download and apply it now</a> — no restart required.`,
hotfix_to_hotfix_update: `[UNTRANSLATED] You are running OpenWF Bootstrapper v<span class="local-version-full"></span>. The latest hotfix is <b class="hotfix-available"></b>. If you want, I can <a href="#" onclick="fetch('/download_latest_hotfix')">download and apply it now</a> — no restart required.`,
server_host: `服务器主机`,
server_host_submit: `更改`,
logout: `注销`,

47
update.php Normal file
View File

@ -0,0 +1,47 @@
<?php
function extract_strings($cont)
{
preg_match_all("/([a-z_]+): `([^`]*)`,/", $cont, $matches, PREG_SET_ORDER, 0);
$strings = [];
foreach ($matches as $match)
{
$strings[$match[1]] = $match[2];
}
return $strings;
}
$source = file_get_contents("client-webui/en.js");
$source_strings = extract_strings($source);
$source_lines = explode("\n", $source);
foreach (scandir("client-webui") as $file)
{
if (is_file("client-webui/$file") && $file != "en.js")
{
$cont = file_get_contents("client-webui/$file");
$target_strings = extract_strings($cont);
$fh = fopen("client-webui/$file", "wb");
fwrite($fh, explode("\n", $cont)[0]."\n");
foreach ($source_lines as $line)
{
if ($strings = extract_strings($line))
{
foreach ($strings as $key => $value)
{
if (array_key_exists($key, $target_strings))
{
fwrite($fh, "\t$key: `$target_strings[$key]`,\n");
}
else
{
fwrite($fh, "\t$key: `[UNTRANSLATED] $value`,\n");
}
}
}
else
{
fwrite($fh, $line."\n");
}
}
}
}