Skip to content

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

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

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/components/currency-amount.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import Component from '@glimmer/component';
const locales = {
'de' : 'de-DE',
'zh_Hans' : 'zh-CN',
'zh_Hant' : 'zh-TW'
'zh_Hant' : 'zh-TW',
'fa_IR' : 'fa-IR'
};

export default class CurrencyAmount extends Component {
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/general-date.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const dateFormats = {
'tz' : ' '
};

const locales12Hours = new Set(['en', 'bn', 'hi', 'id', 'ja', 'run', 'th', 'vi', 'ko']);
const locales12Hours = new Set(['en', 'bn', 'fa_IR', 'hi', 'id', 'ja', 'run', 'th', 'vi', 'ko']);

export function generalDate(params, { tz }) {
const timezone = tz || moment.tz.guess();
Expand Down
3 changes: 3 additions & 0 deletions app/services/l10n.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default class L10nService extends L10n {
'de' : 'Deutsch',
'en' : 'English',
'es' : 'Español',
'fa_IR' : 'فارسی',
'fr' : 'Français',
'hi' : 'हिंदी',
'hr' : 'Hrvatski',
Expand Down Expand Up @@ -82,6 +83,8 @@ export default class L10nService extends L10n {
locale = 'zh-tw';
} else if (locale === 'nb_NO') {
locale = 'nb';
} else if (locale === 'fa_IR') {
locale = 'fa-IR';
}

getScript(`/assets/moment-locales/${locale}.js`)
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/forms/group/group-view.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<img src="{{@group.logoUrl}}" class="logo mr-8" />
{{/if}}
<div>
<h1 class="event name text-white">{{@group.name}}</h1>
<h1 class="event name text-white" dir="auto">{{@group.name}}</h1>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/templates/public.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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>

</LinkTo>
<h4 class="event location" style={{this.vietnameseFontFamily}}><i class="icon map marker alternate"></i>{{this.headerLocation}}</h4>
</div>
Expand All @@ -30,7 +30,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>
</LinkTo>
<h4 class="event location" style={{this.vietnameseFontFamily}}><i class="icon map marker alternate"></i>{{this.headerLocation}}</h4>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/public/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
{{/if}}
{{#if this.model.event.description}}
<div class="description" id="info">
<div class="description" id="info" dir="auto">
{{sanitize this.model.event.description}}
</div>
<div class="ui hidden divider"></div>
Expand Down
5 changes: 5 additions & 0 deletions app/utils/dictionary/fluent-language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ export const fluentLanguage = [
code : 'es-ES',
isChecked : false
},
{
name : 'فارسی',
code : 'fa-IR',
isChecked : false
},
{
name : 'Français',
code : 'fr-FR',
Expand Down
5 changes: 5 additions & 0 deletions app/utils/dictionary/native-language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ export const nativeLanguage = [
code : 'es-ES',
isChecked : false
},
{
name : 'فارسی',
code : 'fa-IR',
isChecked : false
},
{
name : 'Français',
code : 'fr-FR',
Expand Down
8 changes: 7 additions & 1 deletion app/utils/dictionary/translate-language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export const LANGUAGE_CODE_ENUM = {
ARABIC : 'ar',
HINDI : 'hi',
SWEDISH : 'sv',
NORWEGIAN : 'nb_NO'
NORWEGIAN : 'nb_NO',
PERSIAN : 'fa_IR'
}

export const translateLanguages = [
Expand Down Expand Up @@ -45,6 +46,11 @@ export const translateLanguages = [
code : LANGUAGE_CODE_ENUM.SPANISH,
isChecked : false
},
{
name : 'قارسی',
code : LANGUAGE_CODE_ENUM.PERSIAN,
isChecked : false
},
{
name : 'Français',
code : LANGUAGE_CODE_ENUM.FRENCH,
Expand Down
Binary file added translations/fa_IR.mo
Binary file not shown.
Loading