Browse Source

Feature/set up language localization for Arabic (ar)

Add the Arabic translation of all strings, the build configurations, the
date-fns locale and the language option, which is available with the
experimental features for now.
pull/8483/head
njarrar 24 hours ago
parent
commit
cba653bb41
  1. 5
      CHANGELOG.md
  2. 1
      apps/api/src/services/subscription/subscription.service.ts
  3. 12
      apps/client/project.json
  4. 7
      apps/client/src/app/components/footer/footer.component.html
  5. 7
      apps/client/src/app/components/user-account-settings/user-account-settings.html
  6. 1
      apps/client/src/app/pages/resources/personal-finance-tools/product-page.component.ts
  7. 9885
      apps/client/src/locales/messages.ar.xlf
  8. 1
      libs/common/src/lib/config.ts
  9. 5
      libs/common/src/lib/helper.ts

5
CHANGELOG.md

@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Added
- Set up the language localization for Arabic (`ar`)
- Added support for right-to-left languages
### Changed
- Upgraded `dotenv` from version `18.0.9` to `18.0.10`

1
apps/api/src/services/subscription/subscription.service.ts

@ -291,6 +291,7 @@ export class SubscriptionService {
>,
true
> = {
ar: true,
ca: true,
uk: true
};

12
apps/client/project.json

@ -6,6 +6,10 @@
"prefix": "gf",
"i18n": {
"locales": {
"ar": {
"baseHref": "/ar/",
"translation": "apps/client/src/locales/messages.ar.xlf"
},
"ca": {
"baseHref": "/ca/",
"translation": "apps/client/src/locales/messages.ca.xlf"
@ -94,6 +98,10 @@
]
},
"configurations": {
"development-ar": {
"baseHref": "/ar/",
"localize": ["ar"]
},
"development-ca": {
"baseHref": "/ca/",
"localize": ["ca"]
@ -224,6 +232,9 @@
"sslKey": "apps/client/localhost.pem"
},
"configurations": {
"development-ar": {
"buildTarget": "client:build:development-ar"
},
"development-ca": {
"buildTarget": "client:build:development-ca"
},
@ -279,6 +290,7 @@
"includeContext": true,
"outputPath": "src/locales",
"targetFiles": [
"messages.ar.xlf",
"messages.ca.xlf",
"messages.de.xlf",
"messages.es.xlf",

7
apps/client/src/app/components/footer/footer.component.html

@ -116,6 +116,13 @@
/></a>
</li>
<li>&nbsp;</li>
<!--
<li>
<a href="../ar" title="Ghostfolio in Arabic (العربية)"
>Arabic (العربية)</a
>
</li>
-->
<!--
<li>
<a href="../ca" title="Ghostfolio en català">Català</a>

7
apps/client/src/app/components/user-account-settings/user-account-settings.html

@ -91,6 +91,13 @@
<mat-option [value]="null" />
<mat-option value="de">Deutsch</mat-option>
<mat-option value="en">English</mat-option>
@if (user?.settings?.isExperimentalFeatures) {
<mat-option value="ar"
>Arabic / العربية (<ng-container i18n
>Community</ng-container
>)</mat-option
>
}
@if (user?.settings?.isExperimentalFeatures) {
<mat-option value="ca"
>Català (<ng-container i18n>Community</ng-container

1
apps/client/src/app/pages/resources/personal-finance-tools/product-page.component.ts

@ -42,6 +42,7 @@ export class GfProductPageComponent {
isOpenSource: true,
key: 'ghostfolio',
languages: [
// 'Arabic (العربية)',
// 'Català',
'Chinese (简体中文)',
'Deutsch',

9885
apps/client/src/locales/messages.ar.xlf

File diff suppressed because it is too large

1
libs/common/src/lib/config.ts

@ -402,6 +402,7 @@ export const SECTORS = [
export const STORYBOOK_PATH = '/development/storybook';
export const SUPPORTED_LANGUAGE_CODES = [
'ar',
'ca',
'de',
'en',

5
libs/common/src/lib/helper.ts

@ -28,6 +28,7 @@ import {
subDays
} from 'date-fns';
import {
ar,
ca,
de,
es,
@ -409,7 +410,9 @@ export function getCountryName({ code }: { code: string }): string {
}
export function getDateFnsLocale(aLanguageCode?: string) {
if (aLanguageCode === 'ca') {
if (aLanguageCode === 'ar') {
return ar;
} else if (aLanguageCode === 'ca') {
return ca;
} else if (aLanguageCode === 'de') {
return de;

Loading…
Cancel
Save