Giter Club home page Giter Club logo

typst-linguify's People

Contributors

jomaway avatar sjfhsjfh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sjfhsjfh iilyak

typst-linguify's Issues

Error used inside package

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)
    │                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Panic after Update to 0.4.0

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 = "引理"

Add ability to make wrapping in context optional

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()"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.