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

I18n: Add translation support #91

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

enginqt
Copy link

@enginqt enginqt commented Sep 5, 2024

This pull request is meant to address issue #58 .

Hey there! I'm new here and find the project really cool, so I thought about trying to contribute! :)

I added support for translating the index page and the payment details page. I used the Documentation from Astro and also added a dynamic route for the languages, so that we do not have to duplicate a lot of files for the different languages. If something is not written in another language, the fallback language (default language) is English. Since I can speak german fluently, I translated the pages to german. The links are also dynamic based on the language.

Feel free to run the dev environment and take a look at it! You can switch the language using the dropdown in the navbar:
grafik

Example of the Hero section in german:
grafik

I would be happy if someone would take a look at it and I'm also open to discuss the changes! :D

@enginqt
Copy link
Author

enginqt commented Sep 11, 2024

I have changed the behavior of the index page to redirect to the browser preferredLocale instead of the default locale (en). If their language does not exist as a translation, it will redirect to the default locale (en).

@enginqt enginqt changed the title I18n: Add Translation support I18n: Add translation support Sep 11, 2024
@Kingproone
Copy link
Contributor

How will this look on mobile/ is that dependent on something like #65?

@enginqt
Copy link
Author

enginqt commented Sep 11, 2024

Hey @Kingproone ,

I have looked at the translated page using the dev tools in Firefox. I chose an iPhone 13 as the screen size and compared it to the English page on my real iPhone 13, it looks basically the same (except for the text being a bit more at some places, nothing overlapping though). This should be expected since the only thing that is being changed are strings, not layout.

I would also think about this being fine with the changes from #65 , the only adjustments that would need to be made is to use the useTranslations function instead of hardcoded strings in the hamburger menu, and adjust the links (Which both you can see in my changes as an example and should be pretty simple).

:)

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