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

Added localization #65

Merged
merged 22 commits into from Dec 22, 2023
Merged

Added localization #65

merged 22 commits into from Dec 22, 2023

Conversation

c-leri
Copy link
Contributor

@c-leri c-leri commented Nov 2, 2023


See preview on Cloudflare Pages: https://preview-65.developer-wiki.pages.dev

Copy link
Member

@ix0rai ix0rai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this trigger on pages that aren't linked anywhere? if so, I think the "planned" wording shouldn't be used

@c-leri
Copy link
Contributor Author

c-leri commented Nov 2, 2023

The page that displays for "planned" pages was already there before. I only added a 404 page for routes that don't correspond to a markdown file in the wiki folder

- Got the the wiki's pages metadata out of the markdown files into yaml files
- There is now one markdown file per language for each page
- Changed the way wiki pages are loaded to account for that
- Most texts are now call to the translation store
- Translation files can be found in /src/lib/translations
@c-leri
Copy link
Contributor Author

c-leri commented Nov 3, 2023

Ah oops sorry I shouldn't have pushed that to the same branch, that kinda completely changes the purpose of the pull request

@c-leri c-leri changed the title Displays a 404 error page when trying to access an inexistent wiki page Added localization Nov 3, 2023
@c-leri
Copy link
Contributor Author

c-leri commented Nov 3, 2023

So anyways, this is a proposal of a base for localization as requested in issue #18

This changes the structure of the wiki folder to:

wiki
└── [category_slug]
    ├── +category.yml
    └── [page_slug]
        ├── +page.yml
        ├── en.md
        └── [lang].md

With the pages' metadata taken out of the markdown files and into yaml files.

The markdown files now only include the content of the page so that it can be translated easily by adding a new markdown file for new languages.

For the rest of the text of the application, I simply call a translation store provided by sveltekit-i18n

@c-leri
Copy link
Contributor Author

c-leri commented Nov 4, 2023

I added the french translation as a fonctionnal example

@OroArmor
Copy link
Member

OroArmor commented Nov 4, 2023

Holy shit this is amazing! Thank you so much!

@c-leri
Copy link
Contributor Author

c-leri commented Nov 4, 2023

Glad you like it !

@OroArmor
Copy link
Member

Looks like there is still a bit of missing text here (the language selector):
image

@anonymous123-code
Copy link
Contributor

I was under the impression that we want users to be able to use localization without js enabled (eg. embedded in the URL). Is that still a concern?

@c-leri
Copy link
Contributor Author

c-leri commented Nov 15, 2023

The missing text is supposed to be an icon so maybe it isn't loading for some reason

@c-leri
Copy link
Contributor Author

c-leri commented Nov 15, 2023

Also it should be possible to change the locale depending on the route instead of a local storage variable if you'd prefer that

@c-leri
Copy link
Contributor Author

c-leri commented Nov 15, 2023

The missing text is supposed to be an icon so maybe it isn't loading for some reason

None of the icons are loading actually.

It seems that it is because of an authentification issue when fetching the fontawesome kit, so I don't know if this is just because this is running in a preview server and fontawesome doesn't recognise the url or if this is an actual problem

@OroArmor
Copy link
Member

Seems to just be an issue with the test pages

@c-leri
Copy link
Contributor Author

c-leri commented Nov 15, 2023

I add to make some tweaks to force sveltekit to generate the wiki pages for all languages.

For example, locales now need to be added to the prerender.entries key in the svelte config.
And I also had to add hidden links to the wiki pages in all languages in the sidebar for sveltekit to generate them.

Aside from those two work-around, everything seems to work very nicely :)

@c-leri
Copy link
Contributor Author

c-leri commented Nov 15, 2023

I corrected the issues I found with the previous version such as the page content not reloading correctly when changing locale and it should now work as intended

instead of just trying to use the first one then defaulting to english
@c-leri
Copy link
Contributor Author

c-leri commented Nov 15, 2023

It is now possible to change the locale with javascript disabled! :)

However I noticed during testing that the fontawesome css file imported when javascript is disabled seems to be missing some of icons used in the application

- This is a pure css solution, meaning that the icons are visible even with javascript disabled
- This still allows to use font awesome icons so the site should look identical
- See <https://unocss.dev/presets/icons> for the documentation
@c-leri
Copy link
Contributor Author

c-leri commented Nov 24, 2023

So I found a solution to the icons not working without javascript by using unocss icons preset. This is a pure css solution meaning that no javascript is required after build and it relies on iconify's icon collection which includes font awesome icons so the site looks exactly the same as before.

- With javascript disabled, wiki pages with no locale set will now be displayed in the default locale (english)
- With javascript enabled, wiki pages with no locale set still redirects to the browser default locale
- The lang dropdown now allows to change the locale of a route with no locale set
@OroArmor
Copy link
Member

Looks great! Sorry for not getting to this sooner, last two weeks of school were very busy. Ill merge this in one week to make sure that others have a chance to look at it.

@OroArmor OroArmor added documentation enhancement New feature or request content Relates to the content of the wiki labels Dec 14, 2023
@anonymous123-code
Copy link
Contributor

anonymous123-code commented Dec 15, 2023

Did someone else look over the translations? (My french isnt good enough) We probably should do that before merging this... I should learn to read annoncements properly. Still I think an approval from someone who understands the translations should be a requirement for merging them imo.

@FirstMegaGame4
Copy link

FirstMegaGame4 commented Dec 15, 2023

I'll check the translations in a few hours if you want it, as I'm a native French speaker.

Copy link

@FirstMegaGame4 FirstMegaGame4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may have forgotten some of them.
I'm sorry too, you'll probably hate me with all these review comments.
I hope one review comment does not equals to one notification.

wiki/introduction/get-started/fr.md Outdated Show resolved Hide resolved
wiki/introduction/get-started/fr.md Outdated Show resolved Hide resolved
wiki/introduction/get-started/fr.md Outdated Show resolved Hide resolved
wiki/introduction/get-started/fr.md Outdated Show resolved Hide resolved
wiki/introduction/get-started/fr.md Outdated Show resolved Hide resolved
wiki/concepts/qsl-qfapi/fr.md Outdated Show resolved Hide resolved
wiki/concepts/qsl-qfapi/fr.md Outdated Show resolved Hide resolved
wiki/concepts/qsl-qfapi/fr.md Outdated Show resolved Hide resolved
wiki/concepts/qsl-qfapi/fr.md Outdated Show resolved Hide resolved
wiki/concepts/qsl-qfapi/fr.md Outdated Show resolved Hide resolved
@c-leri
Copy link
Contributor Author

c-leri commented Dec 15, 2023

Sorry for all the french mistakes! I'm a native speaker to but I was mostly focused on the technical aspect and wasn't careful enough when translating 😅
Thank you @FirstMegaGame4 for the review!

@FirstMegaGame4
Copy link

You made a replacement mistake, you replaced "IDEA" by "identifiantIDEA" in some files.
Your work is really great, I'll just check it a last time in about like two hours.

Copy link

@FirstMegaGame4 FirstMegaGame4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are remaining french mistakes that we messed up, we will probably fix them in other PRs for other wiki page translations. This PR looks good to me currently.

@OroArmor OroArmor merged commit a852f76 into QuiltMC:main Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Relates to the content of the wiki enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants