makerspace / makeradmin

Stockholm Makerspace member administration and store.
https://docs.makeradmin.se/
21 stars 16 forks source link

Add english translations to members page #512

Open amrsoll opened 7 months ago

amrsoll commented 7 months ago

It seems like the babel translation tool with .pot file(s) could unify the translation methods, what do you think? I will come with an extra commit to show what I mean

Summary by CodeRabbit

coderabbitai[bot] commented 7 months ago

Walkthrough

The recent updates mainly focus on enhancing the localization and translation capabilities of a webshop project. Changes include the introduction of dynamic content in HTML templates using translation functions, updating Docker configurations to include additional libraries for localization, and modifications in TypeScript files to integrate translation hooks. The project now supports more inclusive language options, improving accessibility for users with different language preferences.

Changes

File(s) Change Summary
public/Dockerfile Updated to include flask_babel for localization support.
public/src/public.py, public/ts/... Integrated localization functionalities like flask_babel.Babel and useTranslation() hooks.
HTML Templates (cart.html, courses.html, etc.) Updated titles and content to use dynamic translation tags ({{ _("Text") }}).
.pot and .po files Updated translation files to support new strings in various languages.
TypeScript Files (member.tsx, translations.tsx) Enhanced translation handling in TypeScript components, added new translation strings and functions.

Recent Review Details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between f5310af7b220851fc8e02850a7229d234cb1fbfa and 85453df5e768f0a225d736fb57cfab9724142f01.
Files ignored due to path filters (1) * `public/babel.cfg` is excluded by `!**/*.cfg`
Files selected for processing (21) * public/Dockerfile (1 hunks) * public/en.pot (1 hunks) * public/src/public.py (3 hunks) * public/src/templates/cart.html (1 hunks) * public/src/templates/courses.html (1 hunks) * public/src/templates/history.html (1 hunks) * public/src/templates/licenses.html (1 hunks) * public/src/templates/login.html (1 hunks) * public/src/templates/member.html (1 hunks) * public/src/templates/payment_form.html (2 hunks) * public/src/templates/product.html (2 hunks) * public/src/templates/quiz/questions.html (1 hunks) * public/src/templates/quiz/quiz.html (1 hunks) * public/src/templates/receipt.html (1 hunks) * public/src/templates/register.html (1 hunks) * public/src/templates/reset_password.html (1 hunks) * public/src/templates/shop.html (1 hunks) * public/src/templates/statistics.html (2 hunks) * public/sv.po (1 hunks) * public/ts/member.tsx (14 hunks) * public/ts/translations.tsx (5 hunks)
Files skipped from review due to trivial changes (7) * public/en.pot * public/src/templates/licenses.html * public/src/templates/member.html * public/src/templates/payment_form.html * public/src/templates/reset_password.html * public/src/templates/shop.html * public/sv.po
Additional comments not posted (23)
public/src/templates/login.html (1)
`4-4`: Title translation implemented correctly. Ensure that the translation system correctly handles the key `"Webshop"` and that it is properly set up in the `.pot` and `.po` files.
public/src/templates/courses.html (1)
`4-4`: Title translation implemented correctly. Ensure that the translation system correctly handles the key `"Courses"` and that it is properly set up in the `.pot` and `.po` files.
public/src/templates/quiz/questions.html (1)
`4-4`: Title translation implemented correctly. Ensure that the translation system correctly handles the key `"Quiz"` and that it is properly set up in the `.pot` and `.po` files.
public/src/templates/history.html (1)
`4-7`: Title translation implemented correctly. Ensure that the translation system correctly handles the keys `"Purchase History"` and `"Webshop"` and that they are properly set up in the `.pot` and `.po` files.
public/src/templates/register.html (1)
`4-4`: Title translation implemented correctly. Ensure that the translation system correctly handles the key `"Become a Member"` and that it is properly set up in the `.pot` and `.po` files.
public/src/templates/receipt.html (1)
`4-4`: Title translation implemented correctly. Ensure that the translation system correctly handles the key `"Webshop"` and that it is properly set up in the `.pot` and `.po` files.
public/Dockerfile (1)
`21-21`: Addition of `flask_babel` to Dockerfile is correct. Ensure that `flask_babel` is correctly integrated with the Flask application and that it functions as expected in the container environment.
public/src/templates/cart.html (1)
`4-6`: Title translation implemented correctly. Ensure that the translation system correctly handles the keys `"Shopping Cart"` and `"Webshop"` and that they are properly set up in the `.pot` and `.po` files.
public/src/templates/quiz/quiz.html (1)
`4-4`: Title translation implemented correctly. Please ensure that the translation string for "Quiz" is correctly defined in the translation files.
public/src/templates/statistics.html (2)
`4-4`: Title translation implemented correctly. Please ensure that the translation string for "Statistics" is correctly defined in the translation files. --- `22-22`: Header translation implemented correctly. Please ensure that the translation string for "Statistics for the makerspace" is correctly defined in the translation files.
public/src/templates/product.html (2)
`4-4`: Title translation implemented correctly. Please ensure that the translation string for "Webshop" is correctly defined in the translation files. --- `21-26`: Navigation button translations implemented correctly. Please ensure that the translation strings for "Back" and "Shopping Cart" are correctly defined in the translation files.
public/src/public.py (3)
`8-8`: `flask_babel` import implemented correctly. --- `41-49`: Locale selector function implemented correctly. Please ensure that the locale selection works as expected during integration testing. --- `145-145`: Flask-Babel configuration implemented correctly.
public/ts/translations.tsx (4)
`11-11`: New URLs added for translation context. --- `504-520`: Lab membership translation strings implemented correctly. Please ensure that these translation strings are used correctly in the application. --- `521-543`: Membership translation strings implemented correctly. Please ensure that these translation strings are used correctly in the application. --- `575-583`: Phone number change translation strings implemented correctly. Please ensure that these translation strings are used correctly in the application.
public/ts/member.tsx (3)
`221-221`: Ensure consistent translation key usage. The translation key used here, `member_page.old_membership_status.labaccess.inactive_recent`, should be verified for consistency across the application to ensure it matches other similar usage contexts. --- `519-519`: Validate dynamic translation function usage. The dynamic translation function usage here should be validated to ensure that it correctly handles the parameters and returns the expected results in various locales. --- `769-769`: Ensure translation keys are correctly implemented. The translation key `member_page.addr.street_and_number` used here should be verified to ensure it is correctly implemented in the translation files and consistent with other similar keys in the application.
--- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.