Local names for Chinese and Traditional Chinese (#1919)

This commit is contained in:
Kingfree 2023-08-20 18:09:16 +08:00 committed by GitHub
parent 3ab179ebd3
commit 287556bc14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -324,7 +324,7 @@ impl LocalName for EquationElem {
Lang::ARABIC => "معادلة", Lang::ARABIC => "معادلة",
Lang::BOKMÅL => "Ligning", Lang::BOKMÅL => "Ligning",
Lang::CHINESE if option_eq(region, "TW") => "方程式", Lang::CHINESE if option_eq(region, "TW") => "方程式",
Lang::CHINESE => "", Lang::CHINESE => "",
Lang::CZECH => "Rovnice", Lang::CZECH => "Rovnice",
Lang::DANISH => "Ligning", Lang::DANISH => "Ligning",
Lang::DUTCH => "Vergelijking", Lang::DUTCH => "Vergelijking",

View File

@ -8,6 +8,7 @@ use syntect::parsing::{SyntaxDefinition, SyntaxSet, SyntaxSetBuilder};
use typst::diag::FileError; use typst::diag::FileError;
use typst::eval::Bytes; use typst::eval::Bytes;
use typst::syntax::{self, LinkedNode}; use typst::syntax::{self, LinkedNode};
use typst::util::option_eq;
use super::{ use super::{
FontFamily, FontList, Hyphenate, LinebreakElem, SmartQuoteElem, TextElem, TextSize, FontFamily, FontList, Hyphenate, LinebreakElem, SmartQuoteElem, TextElem, TextSize,
@ -320,11 +321,12 @@ impl Finalize for RawElem {
} }
impl LocalName for RawElem { impl LocalName for RawElem {
fn local_name(&self, lang: Lang, _: Option<Region>) -> &'static str { fn local_name(&self, lang: Lang, region: Option<Region>) -> &'static str {
match lang { match lang {
Lang::ALBANIAN => "List", Lang::ALBANIAN => "List",
Lang::ARABIC => "قائمة", Lang::ARABIC => "قائمة",
Lang::BOKMÅL => "Utskrift", Lang::BOKMÅL => "Utskrift",
Lang::CHINESE if option_eq(region, "TW") => "程式",
Lang::CHINESE => "代码", Lang::CHINESE => "代码",
Lang::CZECH => "Seznam", Lang::CZECH => "Seznam",
Lang::DANISH => "Liste", Lang::DANISH => "Liste",

View File

@ -3,6 +3,7 @@ use std::path::Path;
use typst::geom::Smart; use typst::geom::Smart;
use typst::image::{Image, ImageFormat, RasterFormat, VectorFormat}; use typst::image::{Image, ImageFormat, RasterFormat, VectorFormat};
use typst::util::option_eq;
use crate::compute::Readable; use crate::compute::Readable;
use crate::meta::{Figurable, LocalName}; use crate::meta::{Figurable, LocalName};
@ -231,11 +232,12 @@ impl Layout for ImageElem {
} }
impl LocalName for ImageElem { impl LocalName for ImageElem {
fn local_name(&self, lang: Lang, _: Option<Region>) -> &'static str { fn local_name(&self, lang: Lang, region: Option<Region>) -> &'static str {
match lang { match lang {
Lang::ALBANIAN => "Figurë", Lang::ALBANIAN => "Figurë",
Lang::ARABIC => "شكل", Lang::ARABIC => "شكل",
Lang::BOKMÅL => "Figur", Lang::BOKMÅL => "Figur",
Lang::CHINESE if option_eq(region, "TW") => "",
Lang::CHINESE => "", Lang::CHINESE => "",
Lang::CZECH => "Obrázek", Lang::CZECH => "Obrázek",
Lang::DANISH => "Figur", Lang::DANISH => "Figur",