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

Add multi-langauge support #22

Merged
merged 3 commits into from
Apr 15, 2024
Merged
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
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@ Documentation for this template is published with each commit. See the attached
| ![Resume](assets/images/resume.png) | ![Cover Letter](assets/images/coverletter.png) |
| ![Resume 2](assets/images/resume2.png) | ![Cover Letter 2](assets/images/coverletter2.png)|

## Building and Testing Locally

To build and test the project locally, you will need to install the `typst` CLI. You can find instructions on how to do this [here](https://typst.app/docs/getting-started).

With typst installed you can make changes to `lib.typ` and then `install_package_locally.ps1` to install the package locally. Change the import statements in the template files to point to the local package:

```typst
#import "@local/modern-cv:0.3.0": *
````

Note that the script parses the `typst.toml` to determine the version number and the folder the local files are installed to.

### Formatting

This project uses [typstyle](https://github.com/Enter-tainer/typstyle) to format the code. The script `format_typst.ps1` will format all the `*.typ` files in the project. Be sure to install `typstyle` before running the script.

## License

The project is licensed under the MIT license. See [LICENSE](LICENSE) for more details.
Expand Down
Binary file modified assets/images/coverletter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/coverletter2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/resume.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions lang.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[conf]
default-lang = "en"

[lang.en]
resume = "Résumé"
dear = "Dear"
cover-letter = "Cover Letter"
attached = "Attached"
curriculum-vitae = "Curriculum Vitae"

[lang.de]
resume = "Lebenslauf"
dear = "Sehr geehrte"
cover-letter = "Anschreiben"
attached = "Angehängt"
curriculum-vitae = "Lebenslauf"

[lang.gr]
resume = "Βιογραφικό"
dear = "Αγαπητέ"
cover-letter = "Συνοδευτική Επιστολή"
attached = "Συνημμένο"
curriculum-vitae = "Βιογραφικό"

[lang.sp]
resume = "Currículum"
dear = "Estimado"
cover-letter = "Carta de Presentación"
attached = "Adjunto"
curriculum-vitae = "Currículum"
28 changes: 21 additions & 7 deletions lib.typ
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import "@preview/fontawesome:0.1.0": *
#import "@preview/linguify:0.4.0": *

// const color
#let color-darknight = rgb("#131A28")
Expand Down Expand Up @@ -126,27 +127,31 @@
/// - date (string): The date the resume was created
/// - accent-color (color): The accent color of the resume
/// - colored-headers (boolean): Whether the headers should be colored or not
/// - language (string): The language of the resume, defaults to "en". See lang.toml for available languages
/// - body (content): The body of the resume
/// -> none
#let resume(
author: (:),
date: datetime.today().display("[month repr:long] [day], [year]"),
accent-color: default-accent-color,
colored-headers: true,
language: "en",
body,
) = {
if type(accent-color) == "string" {
accent-color = rgb(accent-color)
}

let lang_data = toml("lang.toml")

set document(
author: author.firstname + " " + author.lastname,
title: "resume",
)

set text(
font: ("Source Sans Pro"),
lang: "en",
lang: language,
size: 11pt,
fill: color-darkgray,
fallback: true,
Expand All @@ -167,7 +172,7 @@
#author.firstname
#author.lastname
#sym.dot.c
#"Résumé"
#linguify("resume", from: lang_data)
]
][
#counter(page).display()
Expand Down Expand Up @@ -410,20 +415,24 @@
profile-picture: image,
date: datetime.today().display("[month repr:long] [day], [year]"),
accent-color: default-accent-color,
language: "en",
body,
) = {
if type(accent-color) == "string" {
accent-color = rgb(accent-color)
}

// language data
let lang_data = toml("lang.toml")

set document(
author: author.firstname + " " + author.lastname,
title: "resume",
title: "cover-letter",
)

set text(
font: ("Source Sans Pro"),
lang: "en",
lang: language,
size: 11pt,
fill: color-darkgray,
fallback: true,
Expand All @@ -444,7 +453,7 @@
#author.firstname
#author.lastname
#sym.dot.c
#"Cover Letter"
#linguify("cover-letter", from: lang_data)
]
][
#counter(page).display()
Expand Down Expand Up @@ -594,7 +603,10 @@
#pad(bottom: 2em)[
#text(weight: "light")[Sincerely,] \
#text(weight: "bold")[#author.firstname #author.lastname] \ \
#text(weight: "light", style: "italic")[Attached: Curriculum Vitae]
#text(weight: "light", style: "italic")[ #linguify(
"attached",
from: lang_data,
)#sym.colon #linguify("curriculum-vitae", from: lang_data)]
]
]
}
Expand Down Expand Up @@ -635,13 +647,15 @@
/// - job-position (string): The job position you are applying for
/// - addressee (string): The person you are addressing the letter to
#let letter-heading(job-position: "", addressee: "") = {
let lang_data = toml("lang.toml")

// TODO: Make this adaptable to content
underline(evade: false, stroke: 0.5pt, offset: 0.3em)[
#text(weight: "bold", size: 12pt)[Job Application for #job-position]
]
pad(top: 1em, bottom: 1em)[
#text(weight: "light", fill: color-gray)[
Dear #addressee,
#linguify("dear", from: lang_data) #addressee,
]
]
}
Expand Down
1 change: 1 addition & 0 deletions template/coverletter.typ
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
),
),
profile-picture: image("./profile.png"),
language: "en",
)

#hiring-entity-info(entity-info: (
Expand Down
1 change: 1 addition & 0 deletions template/coverletter2.typ
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
),
),
profile-picture: none,
language: "en"
)

#hiring-entity-info(entity-info: (
Expand Down
1 change: 1 addition & 0 deletions template/resume.typ
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
),
),
date: datetime.today().display(),
language: "en",
colored-headers: true,
)

Expand Down
Loading