ludwig-austermann / typst-din-5008-letter

A template for DIN 5008 inspired typst letter
MIT License
14 stars 0 forks source link

Wordings #8

Open ondohotola opened 1 year ago

ondohotola commented 1 year ago

Save of modifying wordings.toml, how do I change the (default) word "Anlagen" to something like "Encl."

ludwig-austermann commented 1 year ago

Right now only the third option works without changing the package. You could for instance write:

#import "@local/din-5008-letter:0.1.0"

#let wordings = din-5008-letter.load-wordings("de-formal")
#wordings.insert("attachments", "Encl.")

#show: din-5008-letter.letter.with(wordings: wordings, attachments: ("thing 1", "thing 2"))

#lorem(100)

I think that option 2 would be the nicest one, and should at some point be implemented. You can however already take inspiration of the code, which basically just loads a dictionary from some 'languages', and use this directly in your document.

ondohotola commented 1 year ago

I chose option one, and since I have no clue how a Pull Request works, here my new wordings.toml

[de-formal]
salutation = "Sehr geehrte Damen und Herren"
closing = "Mit freundlichen Grüßen"
attachments = "Anlagen"

[de-informal]
salutation = "Hallo"
closing = "Liebe Grüße"
attachments = "Anlagen"

[debug]
salutation = "<salutation>"
closing = "<closing>"
attachments = "<attachments>"

[us]
salutation = "Dear Sir/Madam"
closing = "With Kind Regards"
attachments = "Encl."
ondohotola commented 12 months ago

How do I adapt this to put something like

"Dear Mr Schmitz"

in my letter, ie a specific, non-generic saluation?

I am not able to adapt option 3 above.

Any advice?

ludwig-austermann commented 12 months ago

You can also do something like:

#let wordings = (
  salutation: [Dear Mr Schmitz],
  closing: "With Kind Regards",
  attachments: "Encl."
)

hence creating the dictionary directly. If you provide labels, you can even have salutation: [Dear @recipient].

I would advise to write a function which returns your default wordings and settings to get a personalized, clean and easy writing experience.

ondohotola commented 12 months ago

Ludwig,

vielen Dank :-)-O

ondohotola commented 12 months ago

Ludwig,

I am a Gynecologist and Obstetrician 17 days from retirement, dabbling a little in Perl and have no clue as to how to write this function.

Can someone reading this assist, please?

ludwig-austermann commented 12 months ago

I mean you probably want something like:

#let wordings(recipient) = (
  salutation: [Dear #recipient],
  closing: "With Kind Regards",
  attachments: "Encl."
)

and then later use #show: letter.with(wordings: wordings("Mr Schmitz"))

ondohotola commented 11 months ago

Thanks,

that works well