Skip to content
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

IDEA: Configure collator language depending on info provided by visited file #19

Open
davorpa opened this issue Sep 10, 2021 · 0 comments

Comments

@davorpa
Copy link

davorpa commented Sep 10, 2021

Defeat

Having a merelly { language: "your lang" } as config object is a bit simple when remark is applied in a multilanguage project.

function alphaCheck(tree, file, language = 'en-US') {

If some rules about naming files are ensured (eg. by path [folder]/en-US/some-markdown-file.md or by file [folder]/some-markdown-file.en-US.md), something very common in software development, it will be easier use this plugin with zero config.

Proposal

Add a new config parameters to enhace it.

Draft:

  • "language-resolver": null: a regex pattern or a function to extract the lang slug using visited tree/file info.
  • "default-language": "en-US": fallback language, when is not supported by Intl webapi or other Collator package.

Use remark-frontmatter plugin could be the best option to extract this info if some microblogging static generators like Jekyll, Hugo, ... are used in the project. So... another param??

  • "use-frontmatter": true

An example of language-resolver can be found at fpb-lint-cli: https://github.com/vhf/free-programming-books-lint/blob/b72812e3cf51e0dce322a30d465f50ee618f3d0c/lib/lint.js#L59-L70

@davorpa davorpa changed the title IDEA: Configure language depending on info provided by visited file IDEA: Configure collator language depending on info provided by visited file Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant