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

Page numbering hardcoded in English #7

Closed
Khoulaiz opened this issue Apr 29, 2024 · 7 comments
Closed

Page numbering hardcoded in English #7

Khoulaiz opened this issue Apr 29, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@Khoulaiz
Copy link

  1. Create a letter with more than 1 page

Expected: For a DIN Letter I would expect a German numbering scheme

Actual: Numbering is using "Page 1 of 2"

@Sematre
Copy link
Owner

Sematre commented Apr 29, 2024

English is just the default. You can change it to German like this:

#show: letter-simple.with(
  // [...]
  page-numbering: (current-page, page-count) => [Seite #current-page von #page-count],
)

@Sematre Sematre added help wanted Extra attention is needed waiting for response labels Apr 29, 2024
@Khoulaiz
Copy link
Author

I know that I can change it. But why is English the default for a Letter following the German DIN standard? Everything else in this letter is in German. Sorry, but this doesn't make sense for me.

@Sematre Sematre added enhancement New feature or request and removed help wanted Extra attention is needed waiting for response labels May 23, 2024
@Sematre
Copy link
Owner

Sematre commented May 23, 2024

The page numbering is the only place where in this library where there is a default English text. Everything else in this library is language independent.

Even tho this letter is following a German standard, documents written in Typst default to the English language. This is why I think it is the best choice to make English the default.

A good compromise could be to use the linguify library that can derive the correct translation from the document context. Would this work for you?

@ondohotola
Copy link

ondohotola commented Oct 20, 2024

English is just the default. You can change it to German like this:

#show: letter-simple.with(
  // [...]
  page-numbering: (current-page, page-count) => [Seite #current-page von #page-count],
)

Is there a way of testing for text.lang and then doing a conditional?

And, how to I change the size of the text Page # of #? I like it a little smaller than the text in the letter.

@Sematre
Copy link
Owner

Sematre commented Oct 20, 2024

Is there a way of testing for text.lang and then doing a conditional?

You can get the current document language with this:

#context {
  let the_language = text.lang
  
  if the_language == "de" {
    "Deutscher Text!"
  } else {
    "English text!"
  }
}

And, how to I change the size of the text Page # of #? I like it a little smaller than the text in the letter.

The page-numbering parameter expects you to return a content type, so you can just call e.g. text(10pt) to make it smaller.

#show: letter-simple.with(
  // [...]
  page-numbering: (current-page, page-count) => text(10pt)[Seite #current-page von #page-count],
)

@ondohotola
Copy link

ondohotola commented Oct 21, 2024

thanks.

I’ll use em though :-)-O

@Sematre
Copy link
Owner

Sematre commented Oct 26, 2024

This feature is now implemented and will be available in the upcoming 3.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants