Skip to content

Request support for naming files in other languages #337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
StringKe opened this issue Nov 25, 2022 · 5 comments
Closed

Request support for naming files in other languages #337

StringKe opened this issue Nov 25, 2022 · 5 comments
Milestone

Comments

@StringKe
Copy link

StringKe commented Nov 25, 2022

https://github.com/contentlayerdev/contentlayer/blob/main/packages/%40contentlayer/core/src/generation/generate-dotpkg.ts#L389

你好.mdx
&&.mdx

Perhaps it would be useful to use something like the functionality in the transliteration package to support files named in other languages?

I might know why other languages are not supported here, could a config item (fileNmaeTransfrom:(name:string)=>string|Promise<string>) be provided in contentlayer.config.ts to allow the user to handle this?

https://www.npmjs.com/package/transliteration

https://discord.com/channels/872106850928164874/872106850928164878/1045543968110301195

@aafnnp
Copy link

aafnnp commented Feb 14, 2023

any sample code?

@StringKe
Copy link
Author

any sample code?

@schickling schickling says he hopes to fix the problem through 'user configuration'.

@majiayu000
Copy link

any sample code?

Just create two mdx file in one folder like 你好.mdx and 你好呀.mdx

It will got redefined error

Generated 43 documents in .contentlayer
error - ./.contentlayer/generated/Blog/_index.mjs
Error:
  x the name `blog__Mdx` is defined multiple times
    ,-[F:\Code\Js\blog\My-blog\.contentlayer\generated\Blog\_index.mjs:39:1]
 39 | import blog__python__PythonMdx from './blog__python__用Python构建区块链.mdx.json' assert { type: 'json' }
 40 | import blog__python__Mdx from './blog__python__量化交易中的地理延迟测试.mdx.json' assert { type: 'json' }
 41 | import blog__rust__rustRustAnalyzerServerMdx from './blog__rust__rust更新和rust-analyzer server安装.mdx.json' assert { type: 'json' }
 42 | import blog__Mdx from './blog__你好.mdx.json' assert { type: 'json' }
    :        ^^^^|^^^^
    :            `-- previous definition of `blog__Mdx` here
 43 | import blog__Mdx from './blog__你好呀.mdx.json' assert { type: 'json' }
    :        ^^^^|^^^^
    :            `-- `blog__Mdx` redefined here

@schickling
Copy link
Collaborator

This should be addressed with the 0.3.3 release. 🎉

@kimploo
Copy link

kimploo commented Oct 16, 2023

This issue closed helped me a lot too! Thx 👍

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

Successfully merging a pull request may close this issue.

5 participants