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 Greek Language ('el') Support and Internationalization #6677

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,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 @@ -48,6 +49,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
10 changes: 10 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 @@ -78,6 +79,15 @@ export async function dynamicActivate(locale: AppLanguage) {
])
break
}
case AppLanguage.el: {
i18n.loadAndActivate({locale, messages: messagesEl})
await Promise.all([
import('@formatjs/intl-datetimeformat/locale-data/el'),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
import('@formatjs/intl-datetimeformat/locale-data/el'),

Following #6742 being reverted in #7196, this line should be deleted.

import('@formatjs/intl-pluralrules/locale-data/el'),
pfrazee marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -46,6 +47,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