Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions i18n.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#let i18n = (
en: (
date_format: "[month repr:short] [day padding:none], [year]",
draft_dated: "Draft dated",
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: (
date_format: "[day]/[month]/[year]",
draft_dated: "Bozza del",
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",
),
)
56 changes: 31 additions & 25 deletions template.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -33,21 +33,27 @@

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(i18n.at(locale).date_format)
]
),
),
)
} else {
Expand All @@ -58,14 +64,13 @@
align(
center,
[

#image(logo, width: 6.5cm)
#v(2em, weak: true)

#upper[Dipartimento di #text(department)]
#upper[#text(department)]
#v(2em, weak: true)

#text(size: 14pt, strong([Corso di #text(course)]))
#text(size: 14pt, strong([#text(course)]))
#line(stroke: (dash: "dotted", thickness: 1pt), length: 100%)
#v(5em)

Expand All @@ -81,20 +86,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()
Expand All @@ -110,8 +115,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)
]
]
],
Expand All @@ -134,14 +139,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)
},
)
Expand All @@ -155,14 +160,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)
Expand All @@ -186,6 +190,7 @@
set-page-properties()

show: codly-init.with()

codly(
number-format: none,
zebra-fill: none,
Expand All @@ -199,9 +204,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"
)
}
}
14 changes: 5 additions & 9 deletions tesi.typ
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@
"Dott. Paperino"
),
department: "Dipartimento della Televisione dei Ragazzi",
course: "Laurea in Scienze dell'Albero Azzurro",
session: "di Luglio",
aa: "2000/2001",
course: "Corso di Laurea in Scienze dell'Albero Azzurro",
session: "Luglio",
academic_year: "2000/2001",
abstract: [
#lorem(100)
],
dedication: [
A quella puntata della Melevisione interrotta a metà.
],
final: true,
// locale: "en",
// bibliography_file: "./bib.yml",
)

= Introduzione
Expand All @@ -41,9 +43,3 @@ if x == 1 {
print("Hello, world!")
}
```