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

Create config constant for the lang attribute #133

Closed
fchrapek opened this issue Sep 27, 2023 · 3 comments
Closed

Create config constant for the lang attribute #133

fchrapek opened this issue Sep 27, 2023 · 3 comments

Comments

@fchrapek
Copy link

fchrapek commented Sep 27, 2023

If you're using LOCALE = ["en-EN"] it might be worth adding the LANG constant and adjusting the Layout.astro so all the minimum language settings are in one place.

What do you think? I can handle the PR for it.

@satnaing
Copy link
Owner

satnaing commented Oct 3, 2023

🤔
I'm a bit confused about this. LANG from src/config.ts is currently only used inside src/components/Datetime.tsx.
Could you please provide a bit more detail on how you'd implement this?

@fchrapek
Copy link
Author

fchrapek commented Oct 3, 2023

Right, I wasn't very clear.

What I meant is that if you want to change the default, let's call them language settings, apart from the LOCALE variable, you also have to manually change the global lang attribute in the Layout.astro (currently it's set to en).

The simplest solution would be to add another variable. Or we could create a single var and pass to the LOCALE with toUpperCase().

It's a minor thing, but it might improve the overall UX experience :)

@satnaing
Copy link
Owner

Good idea.
I'm thinking of something like LOCALE object. This is because html lang code and BCP 47 Language can be different I guess.

export const LOCALE = {
  lang: "en", // html lang code. Set this empty and default will be "en"
  langTag: ["en-EN"], // BCP 47 Language Tags. Set this empty [] to use the environment default
} as const;

What do you think? You can PR if you want; and maybe I'll co-author.

Stark-X added a commit to Stark-X/my-astro-blog that referenced this issue Jan 6, 2024
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

2 participants