al1abb / invoify

An invoice generator app built using Next.js, Typescript, and Shadcn
https://invoify.vercel.app
MIT License
368 stars 72 forks source link

feat: Add arabic translation #469

Closed ibkhall closed 1 week ago

ibkhall commented 1 week ago

Summary by CodeRabbit

coderabbitai[bot] commented 1 week ago

Walkthrough

The changes introduce Arabic localization support to the invoice management system. A new JSON file, i18n/locales/ar.json, has been created to provide Arabic translations for various UI components, including forms, actions, and footers. Additionally, the LOCALES array in lib/variables.ts has been updated to include Arabic as a supported language, enhancing the application's internationalization.

Changes

Files Change Summary
i18n/locales/ar.json Added a new JSON file for Arabic translations, covering forms, actions, and footer elements.
lib/variables.ts Updated the LOCALES array to include Arabic with the entry { code: "ar", name: "العربية" }.

Poem

In the land of the sun, where the rabbits play,
New words for the Arabic, brightening the day.
Forms and actions now speak with delight,
Hopping through invoices, everything feels right!
With every new locale, our hearts leap and bound,
Celebrating together, in joy we are found! 🐰✨


:scroll: Recent review details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
:inbox_tray: Commits Files that changed from the base of the PR and between 6ba907c78eb4fd9b1728025ff12ba3def77d60dd and 89a1bd079bb387cc19f3482c5ca2312128cee36d.
:ledger: Files selected for processing (2) * i18n/locales/ar.json (1 hunks) * lib/variables.ts (1 hunks)
:mute: Additional comments not posted (6)
i18n/locales/ar.json (5)
`1-92`: **Well-structured localization file** The overall structure of the JSON file is well-organized, with clear separation between form, actions, and footer sections. The nesting of objects follows a logical hierarchy, which will facilitate easy maintenance and updates in the future. --- `80-88`: **Complete translations for action items** The actions section provides appropriate Arabic translations for common operations in an invoice management system, including loading, exporting, and generating PDFs. All visible action labels have been translated, which will ensure a seamless user experience for Arabic-speaking users. --- `1-92`: **Excellent addition of Arabic localization** This new `ar.json` file is a significant step towards internationalizing the invoice management system. The translations are comprehensive, covering all major aspects of the application including forms, actions, and footer elements. The JSON structure is well-organized and follows best practices for localization files. To finalize this feature: 1. Have a native Arabic speaker review the translations for accuracy and natural language use. 2. Cross-check with the English version to ensure no translations are missing. 3. Test the application with these Arabic translations to verify proper rendering and functionality, especially for right-to-left (RTL) layout. 4. Consider adding comments in the JSON file for complex terms or context-dependent translations to aid future maintenance. Great work on expanding the application's language support! --- `2-78`: **Comprehensive form section translations** The form section provides extensive Arabic translations for all aspects of invoice creation, including sender/receiver information, invoice details, line items, payment info, and summary. The wizard steps are clearly defined, and all visible text elements have been translated. However, to ensure the highest quality of localization: 1. Please have a native Arabic speaker verify the correctness and naturalness of the translations. 2. Double-check that no form elements or labels are missing from this translation file. To help verify the completeness of the translations, you can run the following script to compare the keys in this file with the English version: This script will help identify any missing or extra keys in the Arabic translation file compared to the English version.
:white_check_mark: Verification successful To address the issue with the previous script, please run the following updated script that uses temporary files instead of process substitution: --- **Translation keys are complete** All keys in `ar.json` match those in `en.json`, ensuring that the Arabic translation file is comprehensive and no keys are missing or extra. Next steps: 1. Have a native Arabic speaker verify the correctness and naturalness of the translations.
:checkered_flag: Scripts executed The following scripts were executed for the analysis: Script: ```shell #!/bin/bash # Description: Compare keys in ar.json with en.json to ensure completeness # Find the English JSON file en_file=$(fd -e json -p "i18n/locales/en.json") if [ -z "$en_file" ]; then echo "Error: en.json file not found" exit 1 fi # Compare keys diff <(jq -r 'path(..|select(type=="string")) | join(".")' i18n/locales/ar.json | sort) \ <(jq -r 'path(..|select(type=="string")) | join(".")' "$en_file" | sort) # If there's no output, all keys match if [ $? -eq 0 ]; then echo "All keys in ar.json match en.json" else echo "Differences found. Please review the output above." fi ``` Length of output: 516 --- Script: ```shell #!/bin/bash # Description: Compare keys in ar.json with en.json to ensure completeness using temporary files # Find the English JSON file en_file=$(fd -e json -p "i18n/locales/en.json") if [ -z "$en_file" ]; then echo "Error: en.json file not found" exit 1 fi # Extract and sort keys from ar.json jq -r 'path(..|select(type=="string")) | join(".")' i18n/locales/ar.json | sort > /tmp/ar_keys_sorted.txt # Extract and sort keys from en.json jq -r 'path(..|select(type=="string")) | join(".")' "$en_file" | sort > /tmp/en_keys_sorted.txt # Compare the keys diff /tmp/ar_keys_sorted.txt /tmp/en_keys_sorted.txt # Check the result of diff if [ $? -eq 0 ]; then echo "All keys in ar.json match en.json" # Clean up temporary files rm /tmp/ar_keys_sorted.txt /tmp/en_keys_sorted.txt else echo "Differences found. Please review the output above." # Note: Temporary files are kept for review fi ``` Length of output: 469
--- `89-91`: **Footer translation provided** The footer section includes the Arabic translation for "developed by". This is appropriate for giving credit to the developer. To ensure completeness, please verify if there are any other footer elements typically present in the application that might need translation. You can check this by comparing with the English version: This will help ensure that all necessary footer elements are translated.
:white_check_mark: Verification successful **Footer translation verified successfully** The footer section in `ar.json` matches the English version in terms of keys and provides the appropriate translation for "developed by."
:checkered_flag: Scripts executed The following scripts were executed for the analysis: Script: ```shell #!/bin/bash # Description: Compare footer section in ar.json with en.json # Find the English JSON file en_file=$(fd -e json -p "i18n/locales/en.json") if [ -z "$en_file" ]; then echo "Error: en.json file not found" exit 1 fi # Compare footer sections diff <(jq '.footer' i18n/locales/ar.json) <(jq '.footer' "$en_file") # If there's no output, footer sections match if [ $? -eq 0 ]; then echo "Footer sections in ar.json and en.json match" else echo "Differences found in footer sections. Please review the output above." fi ``` Length of output: 456 --- Script: ```shell #!/bin/bash # Description: Compare footer section in ar.json with en.json using temporary files # Find the English JSON file en_file=$(fd -e json -p "i18n/locales/en.json") if [ -z "$en_file" ]; then echo "Error: en.json file not found" exit 1 fi # Extract footer sections to temporary files jq '.footer' i18n/locales/ar.json > /tmp/ar_footer.json jq '.footer' "$en_file" > /tmp/en_footer.json # Compare footer sections diff /tmp/ar_footer.json /tmp/en_footer.json # Capture the exit status of diff diff_status=$? # Clean up temporary files rm /tmp/ar_footer.json /tmp/en_footer.json # Provide output based on diff result if [ $diff_status -eq 0 ]; then echo "Footer sections in ar.json and en.json match" else echo "Differences found in footer sections. Please review the output above." fi ``` Length of output: 525 --- Script: ```shell #!/bin/bash # Description: List all keys in the footer section of ar.json and en.json # Find the English JSON file en_file=$(fd -e json -p "i18n/locales/en.json") if [ -z "$en_file" ]; then echo "Error: en.json file not found" exit 1 fi # Extract and list footer keys from ar.json echo "Footer keys in ar.json:" jq -r '.footer | keys[]' i18n/locales/ar.json echo "" # Extract and list footer keys from en.json echo "Footer keys in en.json:" jq -r '.footer | keys[]' "$en_file" ``` Length of output: 347
lib/variables.ts (1)
`56-60`: **LGTM! Verify related changes for Arabic support.** The addition of Arabic to the `LOCALES` array is correct and aligns with the PR objectives. The language code and name are accurate. To ensure complete Arabic support: 1. Verify the existence of corresponding Arabic translation files: 2. Remember to consider Right-to-Left (RTL) layout adjustments for Arabic language support. This may involve CSS changes and layout considerations in your components. Consider implementing a RTL layout switch in your main layout component to handle the text direction change for Arabic. This typically involves adding a `dir="rtl"` attribute to the root HTML element when the Arabic locale is selected.
--- 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?
:heart: 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)
:placard: 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 , please review it.` - `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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@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.` - `@coderabbitai help me debug CodeRabbit configuration file.` 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 using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### CodeRabbit Configuration 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.
vercel[bot] commented 1 week ago

@ibkhall is attempting to deploy a commit to the al1abb-team Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] commented 1 week ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
invoify ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 27, 2024 0:53am