diff --git a/template/lang.json b/template/lang.json index 2de7b8a..18ffb12 100644 --- a/template/lang.json +++ b/template/lang.json @@ -57,7 +57,7 @@ "toc": "Contents", "disclaimer": "Declaration", - "disclaimer_content": "I hereby certify, I, myself, have written my {thesis} as an original and primary work using the literature listed below and consulting it with my thesis supervisor and my thesis counsellor.\n\nI acknowledge that my {thesis} is fully governed by Act No. 121/2000 Coll., the Copyright Act, in particular Article 60 – School Work.\n\nI acknowledge that the Technical University of Liberec does not infringe my copyrights by using my {thesis} for internal purposes of the Technical University of Liberec.\n\nI am aware of my obligation to inform the Technical University of Liberec on having used or granted license to use the results of my {thesis}; in such a case the Technical University of Liberec may require reimbursement of the costs incurred for creating the result up to their actual amount.\n\nAt the same time, I honestly declare that the text of the printed version of my {thesis} is identical with the text of the electronic version uploaded into the IS STAG.\n\nI acknowledge that the Technical University of Liberec will make my {thesis} public in accordance with paragraph 47b of Act No. 111/1998 Coll., on Higher Education Institutions and on Amendment to Other Acts (the Higher Education Act), as amended.\n\nI am aware of the consequences which may under the Higher Education Act result from a breach of this declaration.", + "disclaimer_content": "{g:I|We} hereby certify, {g:I|we}, {g:myself|ourselves}, have written {g:my|our} {thesis} as an original and primary work using the literature listed below and consulting it with {g:my|our} thesis supervisor and {g:my|our} thesis counsellor.\n\n{g:I|We} acknowledge that {g:my|our} {thesis} is fully governed by Act No. 121/2000 Coll., the Copyright Act, in particular Article 60 – School Work.\n\n{g:I|We} acknowledge that the Technical University of Liberec does not infringe {g:my|our} copyrights by using {g:my|our} {thesis} for internal purposes of the Technical University of Liberec.\n\n{g:I|We} {g:am|are} aware of {g:my|our} obligation to inform the Technical University of Liberec on having used or granted license to use the results of {g:my|our} {thesis}; in such a case the Technical University of Liberec may require reimbursement of the costs incurred for creating the result up to their actual amount.\n\nAt the same time, {g:I|we} honestly declare that the text of the printed version of {g:my|our} {thesis} is identical with the text of the electronic version uploaded into the IS STAG.\n\n{g:I|We} acknowledge that the Technical University of Liberec will make {g:my|our} {thesis} public in accordance with paragraph 47b of Act No. 111/1998 Coll., on Higher Education Institutions and on Amendment to Other Acts (the Higher Education Act), as amended.\n\n{g:I|We} {g:am|are} aware of the consequences which may under the Higher Education Act result from a breach of this declaration.", "disclaimer_replace": { "bp": { diff --git a/template/lang.typ b/template/lang.typ index c58613f..2cf3942 100644 --- a/template/lang.typ +++ b/template/lang.typ @@ -1,4 +1,4 @@ -#import "utils.typ": assert_in_dict, assert_in_arr +#import "utils.typ": assert_in_dict, assert_in_arr, map_none, ok_or #let lang_ids = ( cs: 0, @@ -22,16 +22,26 @@ } #let replace_czech_gender(raw, gender) = { + let genders = ( + feminine: 1, + masculine: 0, + we: 2, + ); + assert_in_dict(gender, genders, "author gender"); raw.replace(regex("\{g:([^|]*)\|([^|]*)\|([^}]*)\}"), (match) => { - if gender == "masculine" { - match.captures.at(0) - } else if gender == "feminine" { - match.captures.at(1) - } else if gender == "we" { - match.captures.at(2) - } else { - panic(); - } + match.captures.at(genders.at(gender)) + }); +} + +#let replace_english_pronounce(raw, pronounce) = { + let pronounce = ok_or(pronounce, "me"); + let pronouns = ( + me: 0, + we: 1, + ); + assert_in_dict(pronounce, pronouns, "author gender"); + raw.replace(regex("\{g:([^|]*)\|([^}]*)\}"), (match) => { + match.captures.at(pronouns.at(pronounce)) }); } @@ -39,9 +49,9 @@ let disclaimer = get_lang_item(language, "disclaimer_content"); let replacements = get_lang_item(language, "disclaimer_replace").at(document_type); if language == "cs" { - let language_genders = ("feminine", "masculine", "we"); - assert_in_arr(author_gender, language_genders, "author gender"); disclaimer = replace_czech_gender(disclaimer, author_gender); + } else if language == "en" { + disclaimer = replace_english_pronounce(disclaimer, author_gender); } for (key, value) in replacements.pairs() { disclaimer = disclaimer.replace("{" + key + "}", value);