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

Add Complete Persian Translations and Support Automatic Text Direction with dir Attribute #9194

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

Goudarz
Copy link

@Goudarz Goudarz commented Mar 16, 2025

Short description of what this resolves:

  1. Complete Persian translations have been added:

    • All msgids were reviewed and translated into Persian.
  2. The dir attribute was added to the UI:

    • The dir attribute dynamically determines text direction (LTR/RTL) based on content.
    • This change improves user experience for right-to-left (RTL) and left-to-right (LTR) languages.

Reasons for These Changes:

  • Enhancing multilingual support for the application.
  • Improving the text rendering for languages with varying text directions.

Areas to Verify:

  • Ensure all translations are accurate and contextually appropriate.
  • Test the dir attribute functionality across all parts of the UI to confirm proper behavior.

Checklist

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the Upstream development branch.
  • The acceptance, integration, unit tests and linter pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Summary by Sourcery

Adds Persian language support and implements automatic text direction based on content.

New Features:

  • Adds support for the Persian language (fa_IR).
  • Implements automatic text direction using the dir attribute, improving the user experience for both LTR and RTL languages.

Copy link

sourcery-ai bot commented Mar 16, 2025

Reviewer's Guide by Sourcery

This pull request adds complete Persian translations and implements automatic text direction detection using the dir attribute. Persian language support was added throughout the application, including language selection, currency formatting, and date formatting. The dir attribute was added to key UI elements to automatically switch between LTR and RTL text direction based on the content.

Updated class diagram for L10nService

classDiagram
  class L10nService {
    +locales: Object
    +momentLocales: Object
    +pluralRules: Object
    +rtlLocales: Set
    +loadLocale(locale: string): Promise<void>
    +setLocale(locale: string): void
    +getLocale(): string
    +t(key: string, options: Object): string
  }
  note for L10nService "Added 'fa_IR' to locales and momentLocales"
Loading

File-Level Changes

Change Details Files
Added Persian language support to the application.
  • Added Persian language code to the language code enum.
  • Added Persian to the list of available languages.
  • Added Persian locale support for currency formatting.
  • Added Persian translation support to the l10n service.
  • Added Persian to the list of locales that use 12-hour time format.
app/utils/dictionary/translate-language.ts
app/utils/dictionary/fluent-language.ts
app/utils/dictionary/native-language.ts
app/components/currency-amount.js
app/services/l10n.js
app/helpers/general-date.js
Implemented automatic text direction detection using the dir attribute.
  • Added dir="auto" to the event name heading in the public template.
  • Added dir="auto" to the group name heading in the group view component template.
  • Added dir="auto" to the event description in the public index template.
app/templates/public.hbs
app/templates/components/forms/group/group-view.hbs
app/templates/public/index.hbs
Added Persian translations.
  • Added a complete set of Persian translations to the application.
translations/fa_IR.po

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

vercel bot commented Mar 16, 2025

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

Name Status Preview Comments Updated (UTC)
open-event-frontend ❌ Failed (Inspect) Mar 17, 2025 7:44am

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Goudarz - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider using a more specific locale than fa-IR if there are regional variations in Persian.
  • Be careful when applying dir=auto to text - it can be surprising when the direction changes.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -12,7 +12,7 @@
<h5 class="event time ends" style={{this.vietnameseFontFamily}}>{{t 'To'}} {{general-date this.model.endsAt 'date-time-tz-long' tz=this.model.timezone}}</h5>
{{/if}}
<LinkTo @route="public">
<h1 class="event name text-white">{{this.model.name}}</h1>
<h1 class="event name text-white" dir="auto">{{this.model.name}}</h1>
Copy link

Choose a reason for hiding this comment

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

suggestion: Addition of dir="auto" for event names improves text direction handling.

This change supports proper rendering for RTL languages. Ensure that similar dynamic text elements are adjusted consistently.

Suggested implementation:

              <h4 class="event location" dir="auto" style={{this.vietnameseFontFamily}}><i class="icon map marker alternate"></i>{{this.headerLocation}}</h4>

                <h4 class="event location" dir="auto" style={{this.vietnameseFontFamily}}><i class="icon map marker alternate"></i>{{this.headerLocation}}</h4>

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