finish arguments translation

This commit is contained in:
2025-12-08 22:23:38 +01:00
committed by Ondřej Mekina
parent 0f03fc2788
commit 7e635c2c06
4 changed files with 50 additions and 23 deletions

View File

@@ -435,7 +435,7 @@ Pokud s šablonou nemáte rozsáhlé zkušenosti, doporučujeme raději využít
// Automaticky generovaný seznam argumentů // Automaticky generovaný seznam argumentů
#import "template/arguments.typ": print_argument_docs #import "template/arguments.typ": print_argument_docs
#print_argument_docs() #print_argument_docs(lang: "cs")
#attachments( #attachments(

View File

@@ -341,9 +341,18 @@
// == CITATIONS == // == CITATIONS ==
let citations = doc( let citations = doc(
// citations // citations
keyval(literal("citations"), string), keyval(literal("citations"), variants(
doc(string, none, (
cs: "Cesta k souboru s bibliografií",
en: "The path to the bibliography file",
)),
doc(slice(string), none, (
cs: "Cesty k souborům s bibliografií",
en: "Paths to the bibliography files",
)),
)),
"citations", "citations",
(cs: "Cesta k souboru s citacemi", en: "A path to the citations file"), (cs: "Zdroj bibliografie", en: "Bibliography source"),
) )
struct( struct(
@@ -360,8 +369,8 @@
) )
} }
#let print_argument_docs() = { #let print_argument_docs(lang: "en") = {
signature_docs(arguments_structure) signature_docs(arguments_structure, lang: lang)
} }
#let check_arguments(args, structure: arguments_structure, namespace: none) = { #let check_arguments(args, structure: arguments_structure, namespace: none) = {

View File

@@ -511,7 +511,7 @@
// BIBLIOGRAPHY // BIBLIOGRAPHY
#let bibliogr(args) = { #let bibliogr(args) = {
let (language, citations_file) = req_arg(args, ("document.language", "citations")); let (language, citations) = req_arg(args, ("document.language", "citations"));
let styles = ( let styles = (
"cs": "../citations/tul-csn690-numeric-square_brackets.csl", "cs": "../citations/tul-csn690-numeric-square_brackets.csl",
"en": "../citations/iso690-numeric-square_brackets.csl", "en": "../citations/iso690-numeric-square_brackets.csl",
@@ -520,7 +520,7 @@
context { context {
if query(ref.where(element: none)).len() > 0 { if query(ref.where(element: none)).len() > 0 {
bibliography( bibliography(
citations_file, citations,
style: style, style: style,
title: get_lang_item(language, "bibliography"), title: get_lang_item(language, "bibliography"),
); );

View File

@@ -3,16 +3,21 @@
inner inner
} }
#let type_primitive(id, name, cs_name) = { #let type_primitive(id, name, cs_name, en_name) = {
(type: "primitive", type_id: id, type_name: name, type_name_cs: cs_name) (type: "primitive", type_id: id, type_name: name, primitive_expl: (cs: cs_name, en: en_name))
} }
#let int = type_primitive("integer", "an 'integer'", "celé číslo"); #let int = type_primitive("integer", "an 'integer'", "celé číslo", "a whole number");
#let float = type_primitive("float", "a 'float'", "desetinné číslo"); #let float = type_primitive("float", "a 'float'", "desetinné číslo", "a decimal number");
#let bool = type_primitive("boolean", "a 'boolean'", "pravdivostní hodnota"); #let bool = type_primitive("boolean", "a 'boolean'", "pravdivostní hodnota", "a truthiness value");
#let string = type_primitive("string", "a 'string'", "textový řetězec"); #let string = type_primitive("string", "a 'string'", "textový řetězec", "a text string");
#let cont = type_primitive("content", "a 'content'", "obsah generovaný Typst syntaxí"); #let cont = type_primitive(
#let null = type_primitive("none", "a 'none'", "prázdná hodnota"); "content",
"a 'content'",
"obsah generovaný Typst syntaxí",
"content generated with Typst syntax",
);
#let null = type_primitive("none", "a 'none'", "prázdná hodnota", "empty value");
#let literal(value) = { #let literal(value) = {
(type: "literal", value: value) (type: "literal", value: value)
@@ -254,6 +259,19 @@
} }
#let signature_docs(target, is_nested: false, lang: "en") = { #let signature_docs(target, is_nested: false, lang: "en") = {
let lang_expr = (
with_keys: (cs: "S klíči", en: "With keys"),
with_values: (cs: "S hodnotami", en: "With values"),
empty: (cs: [prádzné (_none_)], en: [empty (_none_)]),
struct: (
cs: [slovník s přesnými atributy (_dictionary_)],
en: [a dictionary with exact atributes (_dictionary_)],
),
dict: (cs: [slovník (_dictionary_)], en: [_dictionary_]),
slice: (cs: [pole různé délky (_array_): ], en: [variable-length array (_array_): ]),
tuple: (cs: [pole s přesnými prvky (_array_): ], en: [array with exact items (_array_): ]),
)
let typeinfo(target, flatten: false, disable_doc: false) = { let typeinfo(target, flatten: false, disable_doc: false) = {
let try_doc(target, mapper: v => { v }) = { let try_doc(target, mapper: v => { v }) = {
if "doc" in target and not disable_doc { if "doc" in target and not disable_doc {
@@ -265,7 +283,7 @@
if target.type == "struct" { if target.type == "struct" {
if not flatten { if not flatten {
[slovník s přesnými atributy (_dictionary_)] lang_expr.struct.at(lang)
try_doc(target, mapper: v => { try_doc(target, mapper: v => {
[ -- ] [ -- ]
v v
@@ -285,7 +303,7 @@
typeinfo(val, disable_doc: true) typeinfo(val, disable_doc: true)
})) }))
} else if target.type == "dictionary" { } else if target.type == "dictionary" {
[slovník (_dictionary_)] lang_expr.struct.at(lang)
try_doc(target, mapper: v => { try_doc(target, mapper: v => {
[ -- ] [ -- ]
v v
@@ -293,11 +311,11 @@
":" ":"
list( list(
{ {
"S klíči: " lang_expr.with_keys.at(lang) + ": "
typeinfo(target.key) typeinfo(target.key)
}, },
{ {
"S hodnotami: " lang_expr.with_values.at(lang) + ": "
typeinfo(target.val) typeinfo(target.val)
}, },
) )
@@ -306,14 +324,14 @@
v v
": " ": "
}) })
[pole různé délky (_array_) s prvky: ] lang_expr.slice.at(lang)
typeinfo(target.items, disable_doc: true) typeinfo(target.items, disable_doc: true)
} else if target.type == "tuple" { } else if target.type == "tuple" {
try_doc(target, mapper: v => { try_doc(target, mapper: v => {
v v
": " ": "
}) })
[pole (_array_) s upřesněnými prvky: ] lang_expr.tuple.at(lang)
list(..target.items.map(v => { list(..target.items.map(v => {
list.item({ list.item({
typeinfo(v) typeinfo(v)
@@ -321,13 +339,13 @@
})) }))
} else if target.type == "primitive" { } else if target.type == "primitive" {
if target.type_id == "none" { if target.type_id == "none" {
text("prázdné ('none')") lang_expr.empty.at(lang)
try_doc(target, mapper: v => { try_doc(target, mapper: v => {
[ -- ] [ -- ]
text(v) text(v)
}) })
} else { } else {
text(target.type_name_cs + " (") text(target.primitive_expl.at(lang) + " (")
text(target.type_id, style: "italic") text(target.type_id, style: "italic")
text(")") text(")")
try_doc(target, mapper: v => { try_doc(target, mapper: v => {