tl-split: draw the rest of the owl

This commit is contained in:
ed
2025-10-12 22:49:47 +00:00
parent ff01723c6d
commit d099e5e84e
17 changed files with 159 additions and 112 deletions

View File

@@ -30,53 +30,48 @@ after editing tl.js, reload your webbrowser by pressing ctrl-shift-r
def generate_javascript(lang3, native_name, tl_browser):
note = "// NOTE: please use tabs for indenting, not spaces :-)"
if lang3 == "eng":
note += """\n
// NOTE: since you are using the tl.js straight from the repo, you'll
// need to find/replace all "eng" with your own three-letter name"""
note1 = ""
note2 = ""
if lang3 == "hmn":
note1 = ";\n// please adjust this (and the \"Ls.hmn\" further down)"
note2 = """
// the three-letter language-code "hmn" and language-name "Hymmnos"
// is used as an example; please replace these with your language
//"""
return f""""use strict";
{note}
// the three-letter name of the language you're translating to
// the three-letter name of the language you're translating to{note1}
var my_lang = "{lang3}";
// and because we don't know these yet...
var SR='', wah='';
// this function is automatically called when the page is loaded:
////////////////////////////////////////////////////////////////////////
// please ignore the next 5 lines:
var Ls={{}}, SR='', wah='';
function langmod() {{
// which page is the javascript currently running on?
// look for some well-known elements to figure it out:
if (QS("h1#cc") && QS("a#k")) {{
// we are running in the control-panel
Ls[my_lang] = tl_cpanel[my_lang];
}}
else if (ebi("op_cfg")) {{
// we are running in the filebrowser
Ls[my_lang] = tl_browser[my_lang];
// inform the settings tab that a new lang is available
LANGS.push(my_lang);
}}
if (window.LANGN)
LANGN.push([my_lang, Ls[my_lang].tt]);
}}
////////////////////////////////////////////////////////////////////////
// alright,
// below this point is where the actual translation happens;
// here is the pairs of "text-identifier": "text-to-translate"
////////////////////////////////////////////////////////////////////////
// translation of splash.js (the control-panel);
//{note2}
// you do not need to translate the TLNotes, those are just for you :-)
//
// when you are happy with this translation and want to submit it,
// copy the text below into a new file in the translations folder;
// https://github.com/9001/copyparty/tree/hovudstraum/copyparty/web/tl
var tl_cpanel = {{
"{lang3}": {{
Ls.{lang3} = {{
"tt": "{native_name}",
{tl_browser}
"splash": {{
"a1": "refresh",
"b1": "howdy stranger &nbsp; <small>(you're not logged in)</small>",
"c1": "logout",
@@ -115,21 +110,9 @@ var tl_cpanel = {{
"ac1": "enable no304",
"ad1": "enabling no304 will disable all caching; try this if k304 wasn't enough. This will waste a huge amount of network traffic!",
"ae1": "active downloads:",
"af1": "show recent uploads",
}},
"af1": "show recent uploads",
}}
}};
////////////////////////////////////////////////////////////////////////
// translation of browser.js (the filebrowser):
var tl_browser = {{
"{lang3}": {{
"tt": "{native_name}",
{tl_browser}
}};
"""
@@ -158,7 +141,8 @@ def main():
browserjs = f.read().decode("utf-8")
_, browserjs = browserjs.split('\n\t\t"tt": "English",\n', 1)
browserjs, _ = browserjs.split('\n\t"nor": {', 1)
browserjs, _ = browserjs.split('\n}', 1)
browserjs = browserjs.replace("\n\t", "\n")
try:
lang3 = sys.argv[1]