Skip to content

Commit

Permalink
Add Greek Language ('el') Support and Internationalization (#6677)
Browse files Browse the repository at this point in the history
* Add Greek language support to the application

* Add support for Greek language in date handling and tests

* Update Greek locale file with translator and team information

* Add support for Greek language in date handling and tests

* Add support for Greek language in app configuration, and updated translation from the reviewers' comments

* Update src/locale/i18n.ts

Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>

* Update src/locale/i18n.ts

Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 31, 2024
1 parent 30d110d commit 2300410
Show file tree
Hide file tree
Showing 9 changed files with 8,046 additions and 0 deletions.
1 change: 1 addition & 0 deletions app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ module.exports = function (config) {
'ast',
'ca',
'de',
'el',
'es',
'fi',
'fr',
Expand Down
1 change: 1 addition & 0 deletions lingui.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
'ast',
'ca',
'de',
'el',
'en-GB',
'es',
'fi',
Expand Down
2 changes: 2 additions & 0 deletions src/components/hooks/dates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {formatDistance, Locale} from 'date-fns'
import {
ca,
de,
el,
enGB,
es,
fi,
Expand Down Expand Up @@ -50,6 +51,7 @@ const locales: Record<AppLanguage, Locale | undefined> = {
ast: undefined,
ca,
de,
el,
['en-GB']: enGB,
es,
fi,
Expand Down
1 change: 1 addition & 0 deletions src/locale/__tests__/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {AppLanguage} from '#/locale/languages'

test('sanitizeAppLanguageSetting', () => {
expect(sanitizeAppLanguageSetting('en')).toBe(AppLanguage.en)
expect(sanitizeAppLanguageSetting('el')).toBe(AppLanguage.el)
expect(sanitizeAppLanguageSetting('pt-BR')).toBe(AppLanguage.pt_BR)
expect(sanitizeAppLanguageSetting('hi')).toBe(AppLanguage.hi)
expect(sanitizeAppLanguageSetting('id')).toBe(AppLanguage.id)
Expand Down
2 changes: 2 additions & 0 deletions src/locale/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ export function sanitizeAppLanguageSetting(appLanguage: string): AppLanguage {
return AppLanguage.ca
case 'de':
return AppLanguage.de
case 'el':
return AppLanguage.el
case 'en-GB':
return AppLanguage.en_GB
case 'es':
Expand Down
9 changes: 9 additions & 0 deletions src/locale/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {messages as messagesAn} from '#/locale/locales/an/messages'
import {messages as messagesAst} from '#/locale/locales/ast/messages'
import {messages as messagesCa} from '#/locale/locales/ca/messages'
import {messages as messagesDe} from '#/locale/locales/de/messages'
import {messages as messagesEl} from '#/locale/locales/el/messages'
import {messages as messagesEn} from '#/locale/locales/en/messages'
import {messages as messagesEn_GB} from '#/locale/locales/en-GB/messages'
import {messages as messagesEs} from '#/locale/locales/es/messages'
Expand Down Expand Up @@ -81,6 +82,14 @@ export async function dynamicActivate(locale: AppLanguage) {
])
break
}
case AppLanguage.el: {
i18n.loadAndActivate({locale, messages: messagesEl})
await Promise.all([
import('@formatjs/intl-pluralrules/locale-data/el'),
import('@formatjs/intl-numberformat/locale-data/el'),
])
break
}
case AppLanguage.en_GB: {
i18n.loadAndActivate({locale, messages: messagesEn_GB})
await Promise.all([
Expand Down
4 changes: 4 additions & 0 deletions src/locale/i18n.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export async function dynamicActivate(locale: AppLanguage) {
mod = await import(`./locales/de/messages`)
break
}
case AppLanguage.el: {
mod = await import(`./locales/el/messages`)
break
}
case AppLanguage.en_GB: {
mod = await import(`./locales/en-GB/messages`)
break
Expand Down
2 changes: 2 additions & 0 deletions src/locale/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export enum AppLanguage {
ast = 'ast',
ca = 'ca',
de = 'de',
el = 'el',
en_GB = 'en-GB',
es = 'es',
fi = 'fi',
Expand Down Expand Up @@ -49,6 +50,7 @@ export const APP_LANGUAGES: AppLanguageConfig[] = [
{code2: AppLanguage.ast, name: 'Asturianu – Asturian'},
{code2: AppLanguage.ca, name: 'Català – Catalan'},
{code2: AppLanguage.de, name: 'Deutsch – German'},
{code2: AppLanguage.el, name: 'Ελληνικά – Greek'},
{code2: AppLanguage.en_GB, name: 'English (UK)'},
{code2: AppLanguage.es, name: 'Español – Spanish'},
{code2: AppLanguage.fi, name: 'Suomi – Finnish'},
Expand Down
Loading

0 comments on commit 2300410

Please sign in to comment.