jomaway / typst-linguify Goto Github PK
View Code? Open in Web Editor NEWtypst package to load strings for different languages easily.
License: MIT License
typst package to load strings for different languages easily.
License: MIT License
I'm trying to use this package in a template I have published and am getting the following error:
error: dictionary does not contain key "conf"
┌─ @preview/linguify:0.4.0\lib\linguify.typ:73:27
│
73 │ let data_type = database.conf.at("data_type", default: "dict")
│ ^^^^
help: error occurred in this call of function `_linguify`
┌─ @preview/linguify:0.4.0\lib\linguify.typ:136:17
│
136 │ let result = _linguify(key, from: from, lang: lang, args: args)
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Hi, I updated to 0.4.0, and came cross panic
First, I have to mention the README has not been updated.
In my template, I use set-database(toml("lang.toml"))
instead of linguify_set_database(toml("lang.toml"))
, then I got the following error
panic("Could not find a section for the language (" + selected_lang + ") in the linguify database.")
BTW, my lang.toml
is
[conf]
default-lang = "zh"
[lang.zh]
chapter = "章节"
content = "主要内容"
definition = "定义"
theorem = "定理"
lemma = "引理"
I am trying to use the linguify inside the calendar library I am working on. I would need to get string values for months and weekdays in different languages in typst code. Unfortunately it doesn't seem possible due to the fact that the linguify function creates context.
The simplest reproducer
#import "@preview/linguify:0.4.0": *
#let database = toml("lang.toml")
#let localize(weekday) = {
linguify(weekday, from: database, default: weekday)
}
#set text(lang: "en")
#assert.eq("sunday", localize("sunday"))
this code fails with
equality assertion failed: value "sunday" was not equal to "context()"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.