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

feat: add translation for Brazilian Portuguese (pt-BR) #182

Closed
wants to merge 5 commits into from

Conversation

tardisblink
Copy link
Contributor

@tardisblink tardisblink commented Dec 14, 2024

Added a new translation file for Brazilian Portuguese (pt-BR). This includes translations for OAuth error messages, button labels, and other related text. It improves localization support for users in Brazil.

Summary by CodeRabbit

  • New Features
    • Introduced Brazilian Portuguese localization for the Shield OAuth project, including error messages and UI strings for login and registration.
    • Added support for GitHub and Google authentication messages tailored for Brazilian Portuguese users.

Added a new translation file for Brazilian Portuguese (pt-BR). This includes translations for OAuth error messages, button labels, and other related text. It improves localization support for users in Brazil.
Copy link

coderabbitai bot commented Dec 14, 2024

Walkthrough

A new language file for Brazilian Portuguese (pt-BR) has been added to the Shield OAuth project. This file, ShieldOAuthLang.php, provides localized error messages and user interface strings specifically tailored for Brazilian Portuguese speakers. The file contains comprehensive translations for various OAuth-related scenarios, including error handling, login prompts, and authentication messages for services like GitHub and Google.

Changes

File Change Summary
src/Language/pt-BR/ShieldOAuthLang.php New language file added with Brazilian Portuguese translations for OAuth-related messages and error strings

Poem

🇧🇷 A rabbit hops through OAuth's gate
With Portuguese words, now localize!
Errors translated, messages bright
Brazilian language takes its flight
Shield's multilingual charm ignites! 🐰🌍

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. This feature will be included in our Pro Plan when released.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
src/Language/pt-BR/ShieldOAuthLang.php (1)

1-44: Consider adding translation test coverage.

The translations look good overall. Consider implementing automated tests to verify:

  1. All required translation keys are present
  2. Placeholder consistency across languages
  3. No missing translations compared to the default language

Would you like me to help create a test suite for validating translations?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bb1d442 and aae8662.

📒 Files selected for processing (1)
  • src/Language/pt-BR/ShieldOAuthLang.php (1 hunks)
🔇 Additional comments (4)
src/Language/pt-BR/ShieldOAuthLang.php (4)

1-13: LGTM! File header follows PHP best practices.

The file includes proper strict type declaration and copyright information.


26-28: LGTM! UI strings are clear and consistent.

The translations for UI elements are concise and follow proper formatting conventions.


14-15: Verify consistency with other language files.

The structure looks good, but let's ensure it matches other language files in the project.

✅ Verification successful

Structure matches other language files perfectly

The verification shows that all language files (en, fa, fr, id) follow the exact same structure:

  • Same file header with copyright notice
  • Same comment "ShieldOAuthLang language file"
  • Same array return structure with identical keys organization
  • Consistent indentation and formatting
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the structure matches other language files
# Expected: Similar array structure in other language files

# Find and show structure of other language files
fd ShieldOAuthLang.php src/Language --exclude pt-BR | xargs head -n 20

Length of output: 2552


16-23: Verify placeholder consistency across translations.

The translations look natural while maintaining technical accuracy. The use of placeholders (e.g., "{0}") in messages like account_not_found and access_denied is correct.

✅ Verification successful

Placeholder usage is consistent across all language files

The verification shows that the placeholder pattern {0} is consistently used across all language files (en, fr, fa, id, pt-BR) for both account_not_found and access_denied messages. The placeholders maintain the same format and position in each translation, ensuring proper string interpolation will work as expected.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check placeholder consistency across language files
# Expected: Same placeholder pattern ({0}) in other language files

# Search for placeholder usage in language files
rg -U "(\{0\})" src/Language/

Length of output: 1289

Comment on lines +30 to +42
// Errors List For all OAuth
'Github' => [
'github' => 'GitHub',
'not_allow' => 'Agora você não pode entrar ou se registrar com o GitHub!',
],
'Google' => [
'google' => 'Google',
'not_allow' => 'Agora você não pode entrar ou se registrar com o Google!',
],
// 'Yahoo' => [
// 'yahoo' => 'Yahoo',
// 'not_allow' => 'Agora você não pode entrar ou se registrar com o Yahoo!',
// ],
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Remove commented Yahoo OAuth sections

The Yahoo OAuth provider is consistently commented out across all language files and the configuration file, indicating it's not an active or planned feature. The commented sections should be removed to maintain clean code:

  • Yahoo configuration is commented out in src/Config/ShieldOAuthConfig.php
  • Yahoo translations are commented out in all language files:
    • src/Language/en/ShieldOAuthLang.php
    • src/Language/fa/ShieldOAuthLang.php
    • src/Language/fr/ShieldOAuthLang.php
    • src/Language/id/ShieldOAuthLang.php
    • src/Language/pt-BR/ShieldOAuthLang.php
🔗 Analysis chain

Query about commented Yahoo section.

The translations for GitHub and Google are well-implemented. However, there's a commented-out Yahoo section that might need clarification:

  • Is Yahoo support planned for the future?
  • Should this commented section be removed if Yahoo support isn't imminent?

Let's check the content of these files to understand the Yahoo implementation status better.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check Yahoo implementation status across the project
# Expected: Find if Yahoo OAuth is implemented or planned

# Search for Yahoo-related implementations
rg -l "Yahoo" --type php

Length of output: 240


Script:

#!/bin/bash
# Check the content of ShieldOAuthConfig.php for Yahoo configuration
echo "=== ShieldOAuthConfig.php ==="
rg -A 5 -B 5 "Yahoo" src/Config/ShieldOAuthConfig.php

# Check if Yahoo is commented out in other language files
echo -e "\n=== Language files Yahoo sections ==="
for file in src/Language/*/ShieldOAuthLang.php; do
    echo -e "\n--- $file ---"
    rg -A 3 -B 1 "Yahoo" "$file"
done

Length of output: 2397

Added a new translation file for Brazilian Portuguese (pt-BR). This includes translations for OAuth error messages, button labels, and other related text. It improves localization support for users in Brazil.
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.

1 participant