#user defined template language

1 messages ยท Page 1 of 1 (latest)

topaz nexus
#

I have been working on a template for my university for a while. and so far its just been in English. A student approached me and asked me if it could also be used in Dutch, and that gave me an idea.

Using an YML document which contains the localization of all terms used in the document, the user can define their own language. It won't do anything to the text the user has written, but all words inserted by the template itself will switch to the chosen language.

#

Also working on something that the user can use to show in which language a document is available in

toxic moss
#

Does this integrate with linguify or is it a custom solution

topaz nexus
#

custom

#

never heard of that lol

toxic moss
#

I see

topaz nexus
#

ahh i see, might be worth checking it out

toxic moss
#

Does it handle grammatical cases or other cases of where a word is different as per context of the sentence its used in?

topaz nexus
#

it does not do anything to the user's text

#

just the template text

toxic moss
#

Ah ok

topaz nexus
#

but i was happy it worked first try, and imo quite well

#

so i shared it here

toxic moss
#

I could use something like that for my template since I intend to rewrite my thesis in English when I'm done

#

But many of the words require additional context like which grammatical case Is used

topaz nexus
#
  // Load language data
  let language-data = yaml("assets/language.yml")
  language = language-data.at(upper(language)).at("localization")
language.at("references")
toxic moss
#

I actually had something half working too, but stopped working on ut

topaz nexus
#

thats it basically

toxic moss
#

I see

topaz nexus
#
EN:
  flag-file: EN-flag.svg
  language-en: English
  language: English
  localization:
    this-doc-is-avail: "This document is available in"
    version-history: "Version history"
    version: "Version"
    date: "Date"
    author: "Author"
    changes: "Changes"
    table-of-contents: "Table of contents"
    glossary: "Glossary"
    index: "Index"
    references: "References"
#

and then this structure per language

toxic moss
#

Looks great nonetheless, although not much different to linguify it seems

topaz nexus
#

yeahh

#

still gonna use this kekw

worldly raptor
#

Well done! Looks good ๐Ÿ™‚ Looks like a nice general solution, I wonder if there's a list of common phrases/words that deserve translations so that templates could just import the right word

#

like, if someone is making a template that has "Chapter 1" or something, then this package provides a function for that which looks up how to translate it in the dictionary

#

CSL style ๐Ÿ˜ฎ

topaz nexus
#

id contribute to that for Dutch 100%

toxic moss
#

Elaborate?

worldly raptor
#

CSL is used for custom citation formats to declare how to render certain things (like how to word the DOI or something)

#

well thats not too far away from how you'd translate "Chapter 1"

#

you could declare a CSL term "chapter-digit" and for english it might look like <group group=" "><term "chapter"><variable "chapter-number"></group>

#

it would then also define "chapter" as a constant literal term

toxic moss
#

I'm gonna go ahead and plead

#

Don't do this

#

CSL is needlessly complex because they chose to use XML

#

And typst had scripting at its disposal

worldly raptor
#

then do it that way, I was just elaborating ๐Ÿ˜›

#

I don't mean literally use the CSL format

toxic moss
#

There have been some ideas floating around about using fluent for localization

#

And I believe linguify supports this already

worldly raptor
#

ooo fluent looks exactly like what I meant

#

(but better)

topaz nexus
#

Pretty happy with that

worldly raptor
#

V nice

latent swallow
# topaz nexus

Want to drive the French, Germans, and Dutch mad? when the user selects de, fr, or nl, use the Belgian flag ๐Ÿ˜„

#

๐Ÿ˜ˆ

topaz nexus
#

LOOOOL

#

Hahahaha

toxic moss
#

:(

#

Mooom, the belgians have delusions of grandeur again

latent swallow
worldly raptor
#

Youre gonna need to gift me a lot of waffles to let that happen

latent swallow
#

๐Ÿ˜ˆ

worldly raptor
#

๐Ÿ˜ 

topaz nexus
autumn quartz
latent swallow
#

and for Portugese, the flag of Brazil!

worldly raptor
latent swallow
#

To be fair, the day I have a company, and it has a website, all FR, DE, and NL will be like Belgian flag with respective flags on the icons ๐Ÿ˜Ž