Skip to content

feat(i18n): WIP YAML support #123

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Zyles
Copy link

@Zyles Zyles commented Feb 10, 2025

WIP YAML support, using server side translation.

Related: #103

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@Zyles
Copy link
Author

Zyles commented Feb 10, 2025

I split the loading of translations if you wanted to keep your old functionality. Maybe you can use globby to get the JSON files too and merge it into one function.

Or you can go through the files without globby if you prefer. Either way works I guess. To be tested for performance diff.

@s00d
Copy link
Owner

s00d commented Feb 11, 2025

Besides integrating locale retrieval, we also need to update the dev tools, write tests, and add information to the documentation.

Regarding the implementation, I don’t really like that we essentially have two identical methods, loadTranslations and loadYamlTranslations—they are 90% the same. I also have some doubts about using globby. Why scan the folder if we can construct the full path directly? Additionally, I’m not entirely sure how this will work in layers, so there are still a lot of open questions.

@Zyles
Copy link
Author

Zyles commented Feb 11, 2025

You are right, I just made it two functions for a proof of concept.

Check this new update. I merged the loading and removed globby.

@Zyles Zyles changed the title feat(i18n) WIP YAML support feat(i18n): WIP YAML support Feb 11, 2025
@s00d
Copy link
Owner

s00d commented Feb 11, 2025

Looks good, a separate function should slightly simplify code maintenance.

@Zyles
Copy link
Author

Zyles commented Feb 23, 2025

What else do you need to merge this?

@s00d
Copy link
Owner

s00d commented Feb 23, 2025

dev tools and write tests

@Zyles
Copy link
Author

Zyles commented Feb 23, 2025

What kind of dev tools?

@s00d
Copy link
Owner

s00d commented Feb 23, 2025

https://github.com/s00d/nuxt-i18n-micro/tree/main/client

https://s00d.github.io/nuxt-i18n-micro/guide/devtools

If you are adding support for a new format, it also requires integration with my module for the dev tool.

@Zyles
Copy link
Author

Zyles commented Feb 23, 2025

Okay and how do you access this?

I have devtools: { enabled: true } in nuxt config but it's not in my devtools.

image

@s00d
Copy link
Owner

s00d commented Feb 23, 2025

image

Press the three dots at the bottom.

@Zyles
Copy link
Author

Zyles commented Feb 23, 2025

Okay got it. But this isn't showing any of the translations in the JSON editor (without my changes):
image

en.json is also empty, on latest version.

@s00d
Copy link
Owner

s00d commented Feb 24, 2025

Okay got it. But this isn't showing any of the translations in the JSON editor (without my changes): image

en.json is also empty, on latest version.

That’s normal—this is a visual editor for the file. If your file is empty, the editor will be empty as well. Choose a file that has translations in it.

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

Successfully merging this pull request may close these issues.

2 participants