-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i18n support added #4
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#let i18n = ( | ||
en: ( | ||
draft_dated: "Draft dated", | ||
department_of: "Department of", | ||
degree_course_in: "Degree programme class in", | ||
supervisor: "Supervisor", | ||
assistant_supervisor: "Assistant supervisor", | ||
assistant_supervisors: "Assistant supervisors", | ||
presented_by: "Presented by", | ||
graduation_session_of: "Graduation session of", | ||
academic_year: "Academic year", | ||
abstract: "Abstract", | ||
table_of_contents: "Table of contents", | ||
bibliography: "Bibliography", | ||
), | ||
it: ( | ||
draft_dated: "Bozza del", | ||
department_of: "Dipartimento di", | ||
degree_course_in: "Corso di", | ||
supervisor: "Relatore", | ||
assistant_supervisor: "Correlatore", | ||
assistant_supervisors: "Correlatori", | ||
presented_by: "Presentata da", | ||
graduation_session_of: "Sessione di", | ||
academic_year: "Anno accademico", | ||
abstract: "Sommario", | ||
table_of_contents: "Indice dei contenuti", | ||
bibliography: "Bibliografia", | ||
), | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,26 +5,26 @@ | |
#import "@preview/fletcher:0.4.2" as fletcher: node, edge | ||
#import "@preview/wrap-it:0.1.0": wrap-content | ||
#import "@preview/lovelace:0.2.0": * | ||
|
||
#let algorithm = algorithm.with(supplement: "Algoritmo") | ||
|
||
#import "i18n.typ": * | ||
|
||
#let project( | ||
title: [], | ||
subtitle: [], | ||
author: [], | ||
professors: (), | ||
school: [], | ||
department: [], | ||
course: [], | ||
session: [], | ||
aa: [], | ||
academic_year: [], | ||
abstract: [], | ||
dedication: [], | ||
final: false, | ||
locale: "it", | ||
bibliography_file: "./bibliography.bib", | ||
body, | ||
) = { | ||
set document(author: author, title: title) | ||
|
||
set page( | ||
paper: "a4", | ||
margin: (x: 2.5cm, y: 1.25cm), | ||
|
@@ -33,21 +33,20 @@ | |
|
||
set text( | ||
font: "Libertinus Serif", | ||
lang: "it", | ||
region: "it", | ||
lang: locale, | ||
region: locale, | ||
size: 12pt, | ||
hyphenate: true, | ||
) | ||
|
||
// Bozza header | ||
set page(header: if not final { | ||
box( | ||
width: 100%, | ||
stroke: 1pt + red, | ||
inset: .5em, | ||
align( | ||
center + horizon, | ||
text(fill: red, size: 18pt, [Bozza del #datetime.today().display("[day]/[month]/[year]")]), | ||
text(fill: red, size: 18pt, [#i18n.at(locale).draft_dated #datetime.today().display("[day]/[month]/[year]")]), | ||
), | ||
) | ||
} else { | ||
|
@@ -58,14 +57,13 @@ | |
align( | ||
center, | ||
[ | ||
|
||
#image(logo, width: 6.5cm) | ||
#v(2em, weak: true) | ||
|
||
#upper[Dipartimento di #text(department)] | ||
#upper[#i18n.at(locale).department_of #text(department)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be better to make this completely customizable, as someone could want to use "Computer Science Department" instead of "Department of Computer Science" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup, totally agree. I'll make it an argument of the project. |
||
#v(2em, weak: true) | ||
|
||
#text(size: 14pt, strong([Corso di #text(course)])) | ||
#text(size: 14pt, strong([#i18n.at(locale).degree_course_in #text(course)])) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing as before, "Computer Engineering Degree" instead of "Degree programme class in" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same for this |
||
#line(stroke: (dash: "dotted", thickness: 1pt), length: 100%) | ||
#v(5em) | ||
|
||
|
@@ -81,20 +79,20 @@ | |
rows: 1, | ||
row-gutter: 2em, | ||
[ | ||
*Relatore:* \ | ||
*#text(i18n.at(locale).supervisor):* \ | ||
#text(professors.at(0), hyphenate: false) | ||
], | ||
{ }, | ||
[ | ||
*Presentata da:* \ | ||
*#text(i18n.at(locale).presented_by):* \ | ||
#text(author) | ||
], | ||
{ | ||
if professors.len() > 1 { | ||
let title = if professors.len() == 2 { | ||
"Correlatore:" | ||
i18n.at(locale).assistant_supervisor | ||
} else { | ||
"Correlatori:" | ||
i18n.at(locale).assistant_supervisors | ||
} | ||
text(size: 14pt, weight: "bold", title) | ||
linebreak() | ||
|
@@ -110,8 +108,8 @@ | |
|
||
#line(stroke: (dash: "solid", thickness: 1pt), length: 100%) | ||
|
||
Sessione #text(session) \ | ||
Anno accademico #text(aa) | ||
#i18n.at(locale).graduation_session_of #text(session) \ | ||
#i18n.at(locale).academic_year #text(academic_year) | ||
] | ||
] | ||
], | ||
|
@@ -134,14 +132,14 @@ | |
|
||
counter(page).update(1) // reset page counter | ||
|
||
show par: set block(spacing: 1.6em) | ||
set par(spacing: 1.6em) | ||
show heading: set block(spacing: 1em) | ||
|
||
if abstract != [] { | ||
align( | ||
horizon, | ||
{ | ||
heading(level: 1, "Sommario") | ||
heading(level: 1, i18n.at(locale).abstract) | ||
text(abstract) | ||
}, | ||
) | ||
|
@@ -155,14 +153,13 @@ | |
|
||
set page(numbering: "1") | ||
|
||
outline(title: [ Indice dei contenuti ], indent: 20pt, depth: 2) | ||
outline(title: i18n.at(locale).table_of_contents, indent: 20pt, depth: 2) | ||
|
||
{ | ||
show heading.where(level: 1): it => { | ||
pagebreak() | ||
v(8cm) | ||
set par(justify: false) | ||
show par: set block(spacing: 0cm) | ||
set par(justify: false, spacing: 0cm) | ||
let c = counter(heading).display("1") | ||
// text(size: 40pt, c) | ||
v(1cm) | ||
|
@@ -186,6 +183,7 @@ | |
set-page-properties() | ||
|
||
show: codly-init.with() | ||
|
||
codly( | ||
number-format: none, | ||
zebra-fill: none, | ||
|
@@ -199,9 +197,10 @@ | |
body | ||
|
||
bibliography( | ||
"./bibliography.bib", | ||
bibliography_file, | ||
title: i18n.at(locale).bibliography, | ||
style: "institute-of-electrical-and-electronics-engineers", | ||
// style: "association-for-computing-machinery", | ||
style: "institute-of-electrical-and-electronics-engineers" | ||
) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add a field for date display in
i18n.typ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I'll add an entry to specify the date format string. Do you have any specific format in mind for the en locale? en-uk should be the same of it locale, but en-us would have month and day swapped, but I wouldn't go this deeper though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about the US format, but I don't think we need it right now so no problems