Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Internationalization #33

Open
recoluan opened this issue Nov 18, 2019 · 15 comments
Open

Internationalization #33

recoluan opened this issue Nov 18, 2019 · 15 comments

Comments

@recoluan
Copy link

Feature request

What problem does this feature solve?

How can I configure internationalization for routes generated by @vuepress/plugin-blog?

What does the proposed API look like?

How should this be implemented in your opinion?

Are you willing to work on this yourself?

No

@billyyyyy3320
Copy link
Member

billyyyyy3320 commented Nov 23, 2019

directories:[
  {
    id: "zh",
    dirname: "_zh",
    path: "/zh/",
    itemLayout: "Post",
    itemPermalink: "/zh/:year/:month/:day/:slug",
  },
  {
    id: "en",
    dirname: "_en",
    path: "/en/",
    itemLayout: "Post",
    itemPermalink: "/en/:year/:month/:day/:slug",
  }
]

Would this configuration meet your needs?

@songzhi
Copy link

songzhi commented Dec 11, 2019

@newsbielt703 For Example,the date formatting needs to be localized,the default is in English,which is so unreadable for non-native English speakers.

@billyyyyy3320
Copy link
Member

@songzhi This plugin doesn't provide date formatting. Probably, you've mixed up blog theme and blog plugin. Btw, blog theme has supported for custom date.

@Mister-Hope
Copy link
Member

Mister-Hope commented Jan 26, 2020

directories:[
  {
    id: "zh",
    dirname: "_zh",
    path: "/zh/",
    itemLayout: "Post",
    itemPermalink: "/zh/:year/:month/:day/:slug",
  },
  {
    id: "en",
    dirname: "_en",
    path: "/en/",
    itemLayout: "Post",
    itemPermalink: "/en/:year/:month/:day/:slug",
  }
]

Would this configuration meet your needs?

What if I want to set a baseLang?

I mean We don't want xxx.com/en/xxxx, just xxx.com/xxxx. We can not deal with that with the option you provided.

Can the dirname change to accept a glob list, or add a excludedirname option?

@Mister-Hope
Copy link
Member

As a workaround, I can fliter the results by using computed options in my layout components, but I still want this feature to support mitulanguage.

@billyyyyy3320
Copy link
Member

Hi @Mister-Hope ,

I mean We don't want xxx.com/en/xxxx, just xxx.com/xxxx. We can not deal with that with the option you provided.

sorry I don't get it. the path is configurable, such as

directories:[
  {
    id: "zh",
    dirname: "_zh",
    path: "/zh/",
    itemPermalink: "/zh/:year/:month/:day/:slug",
  },
  {
    id: "en",
    dirname: "/",
    path: "/en/",
    itemPermalink: "/:year/:month/:day/:slug",
  }
]

Besides, there're some configurable options such as title, frontmatter, getPaginationPageTitle to improve flexibility.

@billyyyyy3320
Copy link
Member

billyyyyy3320 commented Jan 26, 2020

Nevertheless, making dirname accept a glob list is a good idea.

@Mister-Hope
Copy link
Member

Mister-Hope commented Jan 26, 2020

Hi @Mister-Hope ,

I mean We don't want xxx.com/en/xxxx, just xxx.com/xxxx. We can not deal with that with the option you provided.

sorry I don't get it. the path is configurable, such as

directories:[
  {
    id: "zh",
    dirname: "_zh",
    path: "/zh/",
    itemPermalink: "/zh/:year/:month/:day/:slug",
  },
  {
    id: "en",
    dirname: "/",
    path: "/en/",
    itemPermalink: "/:year/:month/:day/:slug",
  }
]

Besides, there're some configurable options such as title, frontmatter, getPaginationPageTitle to improve flexibility.

Excuse me, I think that will cause the en page contains zh tags which I don't want.

As I said, I can filter the auto-generated result, but I still think that excluding it directly will be better

@billyyyyy3320
Copy link
Member

billyyyyy3320 commented Jan 27, 2020

Oops, I modified the wrong line.

directories:[
  {
    id: "zh",
    dirname: "_zh",
    path: "/zh/",
    itemPermalink: "/zh/:year/:month/:day/:slug",
  },
  {
    id: "en",
    dirname: "_en",
    path: "/",
    itemPermalink: "/:year/:month/:day/:slug",
  }
]

That's what I meant.

@Mister-Hope
Copy link
Member

Mister-Hope commented Jan 27, 2020

Oops, I modified the wrong line.

directories:[
  {
    id: "zh",
    dirname: "_zh",
    path: "/zh/",
    itemPermalink: "/zh/:year/:month/:day/:slug",
  },
  {
    id: "en",
    dirname: "_en",
    path: "/",
    itemPermalink: "/:year/:month/:day/:slug",
  }
]

That's what I meant.

But that will make the original markdown links wrong. It means all the xxx.com/yyy/zzz.html will move to xxx.com/en/yyy/zzz.html I just want to add a tag list page and a category list page. And hope that a certain language page do not contain tags or category from another language. Also don't want to change the original link rendered by the folder and file name structure. This is what I want, and I think that this need is common, at least is not strange. And I don't think I can make this without filtering results or add permalinks in markdown files as workaround. This struture is the same as Vuepress Offical Docs.

@Mister-Hope
Copy link
Member

Mister-Hope commented Jan 27, 2020

That's why I suggest the dirname change to accept a glob list, or adding a excludedirname option which can accept a dir list.

Or maybe you can add the same locales logic from vuepress, and add a new localesConfig option? Let the user config some templates once in the localesConfig and apply it on all the languages by reading the themeConfig.locales(or the locales option user give to you).

I think the first one can be an enhance, while the second one is a prefect solution when the project has muti languages.

@billyyyyy3320
Copy link
Member

billyyyyy3320 commented Jan 30, 2020

But that will make the original markdown links wrong. It means all the xxx.com/yyy/zzz.html will move to xxx.com/en/yyy/zzz.html

No it won't, please look carefully at the documentation and the config I offered itemPermalink: "/:year/:month/:day/:slug", both the link and dirname are configurable.

Also don't want to change the original link rendered by the folder and file name structure.

Therefore, the links are not totally rendered by the folder and file name structure as you mentioned.

@billyyyyy3320
Copy link
Member

However, I'll carefully consider the locales config you suggested. 😉

@Mister-Hope
Copy link
Member

Mister-Hope commented Jan 30, 2020

But that will make the original markdown links wrong. It means all the xxx.com/yyy/zzz.html will move to xxx.com/en/yyy/zzz.html

No it won't, please look carefully at the documentation and the config I offered itemPermalink: "/:year/:month/:day/:slug", both the link and dirname are configurable.

First, how can I config itemPermalink, if I am not misunderstanding, a/b/c.md 's slug is a_b_c. So you are suggesting me to write ../:regular ? I am not sure if it works, but I will try it tomorrow.

Besides, as I explained, my project are docs which it's pages are containing lot's of another pages' links. It's heavily depending on the file structure. So I don't think it's a good idea to make my local source file structure and the render results structure different. And I think that costs to much for just a category page and a tag page for each of my language in my website.


Let me explain it more carefully with this example, I have A,B,C,D,E,zh in my doc folder, and in zh there is also A,B,C,D,E five folder. I have fully config the navbar and sidebar options, and in my docs, insteadof writing ../../../B/a/b/c.md from A/a/b/c.md I often use absolute links /B/a/b/c.md.

The first thing you want me to do is to change them to zh,en with has A,B,C,D,E. In fact,though I know there is itemPerminak link, I still don't know how can solve it, besides there are lots of problems happening.

The main effect is that it will render two en docs, one in base, another in base/en.That means if user try to visit xx.com/en/yyy, then it's reachable, and that will case issue if I am writing relative links to anothor language or another website(I serve muti docs on different base in my domain).

Second, I have a folder helding assets for muti language in doc root folder, I have to rewrite every assets path to make them correct.

Third, I have to careful, and remember any time that when I am working on en docs, my path is uncorrect. I have to check every path intelligense my editor gave to me.

I really don't think it's a good idea that when I am writing a docs base on file structures, while they are naviagting to each other, my render structure is different from my source file structure. Beside the render results contain xxx.com/en/yyy which I don't want.

@Mister-Hope
Copy link
Member

However, I'll carefully consider the locales config you suggested. 😉

When can we have it? I really don't want to change my file structure?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants