Giter Site home page Giter Site logo

Multi-language mode design RFC about dumi HOT 9 CLOSED

umijs avatar umijs commented on April 29, 2024
Multi-language mode design RFC

from dumi.

Comments (9)

brickspert avatar brickspert commented on April 29, 2024

demo 的 title, description 如何国际化?
目前 hooks 的做法是:

  1. demo 本身只要英文的,没有中文的。
  2. demo 的 title/description 有中英文区别。

from dumi.

ttys026 avatar ttys026 commented on April 29, 2024

只要没有带 lang 部分的 markdown,就会被当做默认语言渲染。例如,如果我的文档站默认英文,那么我的 markdown 文件应该是 index.md 和 index.zh-CN.md;如果我的文档站默认中文,那么我的 markdown 文件应该是 index.md 和 index.en-US.md

这样 Select 好像并不知道默认语言是什么。
感觉可以是约定 + 可配置式的,比如在 .umirc 里配置一下每个语言的别名:

languages: {
  default: '中文',
  'en-US': 'English',
  'zh-TW': '繁體中文'
}

这样 Select 的下拉框里可以就显示: 中文、English、繁體中文

from dumi.

PeachScript avatar PeachScript commented on April 29, 2024

demo 的 title, description 如何国际化

@brickspert title 和 desc 可以考虑增加字段,比如 title.zh-CN

from dumi.

PeachScript avatar PeachScript commented on April 29, 2024

这样 Select 好像并不知道默认语言是什么。

@tli4 好角度…确实有这个尴尬的问题存在,看来不可避免要提供配置了🤦‍♂️

from dumi.

xiaohuoni avatar xiaohuoni commented on April 29, 2024

这个 lang 原则上不限制格式,也就是说我们写 en 或者 en-US 都会被检测到。

原则上来说不限制格式并没有多余的好处,统一约定好 lang 就好。如 *.zh-CN 为中文

from dumi.

PeachScript avatar PeachScript commented on April 29, 2024

原则上来说不限制格式并没有多余的好处,统一约定好 lang 就好。如 *.zh-CN 为中文

@xiaohuoni 有些用户可能需要在路由上隐藏掉地区,比如 zh-CN 在路由上仅显示为 zh,要支持这个的话就得扩展新配置了

from dumi.

chenshuai2144 avatar chenshuai2144 commented on April 29, 2024

/en/filename -> filename-cn 比较好一点。

/en 你不知道应该放在哪一级,比如 /a/b/c/filename,你不好设置 /en

from dumi.

PeachScript avatar PeachScript commented on April 29, 2024

@chenjsh36 en 永远在最顶层,一般的国际化站点都是这么搞的吧

from dumi.

PeachScript avatar PeachScript commented on April 29, 2024

根据此前的讨论情况提了个 PR,各位一起 review 下:#58

from dumi.

Related Issues (20)

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.