Skip to content

Add Italian language support #11000

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 2 commits into
base: master
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
811 changes: 811 additions & 0 deletions opencti-platform/opencti-front/lang/back/it.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,7 @@
"is not empty": "ist nicht leer",
"is updating...": "wird aktualisiert...",
"is_read": "Wird gelesen?",
"Italian": "Italienisch",
"Japanese": "Japanisch",
"Job Title": "Berufsbezeichnung",
"Job title": "Berufsbezeichnung",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,7 @@
"is not empty": "is not empty",
"is updating...": "is updating...",
"is_read": "Is read?",
"Italian": "Italian",
"Japanese": "Japanese",
"Job Title": "Job Title",
"Job title": "Job title",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,7 @@
"is not empty": "no está vacío",
"is updating...": "se está modificando...",
"is_read": "¿Es leído?",
"Italian": "Italiano",
"Japanese": "Japonés",
"Job Title": "Título profesional",
"Job title": "Título profesional",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,7 @@
"is not empty": "n'est pas vide",
"is updating...": "modifie actuellement...",
"is_read": "Est lu?",
"Italian": "Italien",
"Japanese": "Japonais",
"Job Title": "Titre d'emploi",
"Job title": "Titre d'emploi",
Expand Down
3,455 changes: 3,455 additions & 0 deletions opencti-platform/opencti-front/lang/front/it.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,7 @@
"is not empty": "空でない",
"is updating...": "がアップデート中",
"is_read": "読まれる?",
"Italian": "イタリア語",
"Japanese": "日本語",
"Job Title": "職名",
"Job title": "役職",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,7 @@
"is not empty": "비어 있지 않음",
"is updating...": "업데이트 중...",
"is_read": "읽음 여부",
"Italian": "이탈리아어",
"Japanese": "日本語",
"Job Title": "직함",
"Job title": "직책",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,7 @@
"is not empty": "不为空",
"is updating...": "正在更新...",
"is_read": "只读?",
"Italian": "意大利语",
"Japanese": "日语",
"Job Title": "职称",
"Job title": "职称",
Expand Down
18 changes: 10 additions & 8 deletions opencti-platform/opencti-front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,20 @@
"verify-translation": "node script/verify-translation.js",
"sort-translation": "node script/sort-translation-files.js",
"auto-translation:all": "npm run auto-translation:fr-front $SUBSCRIPTION_KEY && npm run auto-translation:ko-front $SUBSCRIPTION_KEY && npm run auto-translation:cn-front $SUBSCRIPTION_KEY && npm run auto-translation:ja-front $SUBSCRIPTION_KEY && npm run auto-translation:es-front $SUBSCRIPTION_KEY && npm run auto-translation:de-front $SUBSCRIPTION_KEY && npm run auto-translation:fr-back $SUBSCRIPTION_KEY && npm run auto-translation:ko-back $SUBSCRIPTION_KEY && npm run auto-translation:cn-back $SUBSCRIPTION_KEY && npm run auto-translation:ja-back $SUBSCRIPTION_KEY && npm run auto-translation:es-back $SUBSCRIPTION_KEY && npm run auto-translation:de-back $SUBSCRIPTION_KEY && npm run sort-translation",
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for your contribution!
italian is missing in auto-translation:all script.
Could you please add it and then run the script to add missing translations?

"auto-translation:fr-front": "i18n-auto-translation -a deepl-free -p ./lang/front/en.json -t fr -k",
"auto-translation:ko-front": "i18n-auto-translation -a deepl-free -p ./lang/front/en.json -t ko -k",
"auto-translation:cn-front": "i18n-auto-translation -a deepl-free -p ./lang/front/en.json -t zh -k",
"auto-translation:ja-front": "i18n-auto-translation -a deepl-free -p ./lang/front/en.json -t ja -k",
"auto-translation:es-front": "i18n-auto-translation -a deepl-free -p ./lang/front/en.json -t es -k",
"auto-translation:de-front": "i18n-auto-translation -a deepl-free -p ./lang/front/en.json -t de -k",
"auto-translation:fr-back": "i18n-auto-translation -a deepl-free -p ./lang/back/en.json -t fr -k",
"auto-translation:ko-back": "i18n-auto-translation -a deepl-free -p ./lang/back/en.json -t ko -k",
"auto-translation:es-front": "i18n-auto-translation -a deepl-free -p ./lang/front/en.json -t es -k",
"auto-translation:fr-front": "i18n-auto-translation -a deepl-free -p ./lang/front/en.json -t fr -k",
"auto-translation:it-front": "i18n-auto-translation -a deepl-free -p ./lang/front/en.json -t it -k",
"auto-translation:ja-front": "i18n-auto-translation -a deepl-free -p ./lang/front/en.json -t ja -k",
"auto-translation:ko-front": "i18n-auto-translation -a deepl-free -p ./lang/front/en.json -t ko -k",
"auto-translation:cn-back": "i18n-auto-translation -a deepl-free -p ./lang/back/en.json -t zh -k",
"auto-translation:ja-back": "i18n-auto-translation -a deepl-free -p ./lang/back/en.json -t ja -k",
"auto-translation:es-back": "i18n-auto-translation -a deepl-free -p ./lang/back/en.json -t es -k",
"auto-translation:de-back": "i18n-auto-translation -a deepl-free -p ./lang/back/en.json -t de -k",
"auto-translation:es-back": "i18n-auto-translation -a deepl-free -p ./lang/back/en.json -t es -k",
"auto-translation:fr-back": "i18n-auto-translation -a deepl-free -p ./lang/back/en.json -t fr -k",
"auto-translation:it-back": "i18n-auto-translation -a deepl-free -p ./lang/back/en.json -t it -k",
"auto-translation:ja-back": "i18n-auto-translation -a deepl-free -p ./lang/back/en.json -t ja -k",
"auto-translation:ko-back": "i18n-auto-translation -a deepl-free -p ./lang/back/en.json -t ko -k",
"test:e2e": "E2E_TEST=true yarn playwright test --workers=1 --retries=2",
"test:e2e:ui": "E2E_TEST=true yarn playwright test --ui --workers=1",
"generate-test-e2e": "npx playwright codegen http://localhost:3000/",
Expand Down
40 changes: 23 additions & 17 deletions opencti-platform/opencti-front/src/components/AppIntlProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,64 @@ import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';
import { LocalizationProvider } from '@mui/x-date-pickers';
import { createFragmentContainer, graphql } from 'react-relay';
import { Locale } from 'date-fns/locale/types';
import { enUS, fr, es, ja, zhCN, de, ko } from 'date-fns/locale';
import { de, enUS, es, fr, it, ja, ko, zhCN } from 'date-fns/locale';
import locale, { DEFAULT_LANG } from '../utils/BrowserLanguage';
import { UserContext } from '../utils/hooks/useAuth';
import { AppIntlProvider_settings$data } from './__generated__/AppIntlProvider_settings.graphql';
import messages_de_front from '../../lang/front/de.json';
import messages_en_front from '../../lang/front/en.json';
import messages_es_front from '../../lang/front/es.json';
import messages_fr_front from '../../lang/front/fr.json';
import messages_it_front from '../../lang/front/it.json';
import messages_ja_front from '../../lang/front/ja.json';
import messages_zh_front from '../../lang/front/zh.json';
import messages_en_front from '../../lang/front/en.json';
import messages_de_front from '../../lang/front/de.json';
import messages_ko_front from '../../lang/front/ko.json';
import messages_zh_front from '../../lang/front/zh.json';
import messages_de_back from '../../lang/back/de.json';
import messages_en_back from '../../lang/back/en.json';
import messages_es_back from '../../lang/back/es.json';
import messages_fr_back from '../../lang/back/fr.json';
import messages_it_back from '../../lang/back/it.json';
import messages_ja_back from '../../lang/back/ja.json';
import messages_zh_back from '../../lang/back/zh.json';
import messages_en_back from '../../lang/back/en.json';
import messages_de_back from '../../lang/back/de.json';
import messages_ko_back from '../../lang/back/ko.json';
import messages_zh_back from '../../lang/back/zh.json';

import { useDocumentLangModifier } from '../utils/hooks/useDocumentModifier';

type PlatformLang = 'es-es' | 'fr-fr' | 'ja-jp' | 'zh-cn' | 'en-us' | 'de-de' | 'ko-kr';
type PlatformLang = 'de-de' | 'en-us' | 'es-es' | 'fr-fr' | 'it-it' | 'ja-jp' | 'ko-kr' | 'zh-cn';

const localeMap: Record<PlatformLang, Locale> = {
'de-de': de,
'en-us': enUS,
'fr-fr': fr,
'es-es': es,
'fr-fr': fr,
'it-it': it,
'ja-jp': ja,
'zh-cn': zhCN,
'de-de': de,
'ko-kr': ko,
'zh-cn': zhCN,
};

const i18n: { messages: Record<PlatformLang, Record<string, string>> } = {
messages: {
'de-de': { ...messages_de_back, ...messages_de_front },
'en-us': { ...messages_en_back, ...messages_en_front },
'es-es': { ...messages_es_back, ...messages_es_front },
'fr-fr': { ...messages_fr_back, ...messages_fr_front },
'it-it': { ...messages_it_back, ...messages_it_front },
'ja-jp': { ...messages_ja_back, ...messages_ja_front },
'zh-cn': { ...messages_zh_back, ...messages_zh_front },
'en-us': { ...messages_en_back, ...messages_en_front },
'de-de': { ...messages_de_back, ...messages_de_front },
'ko-kr': { ...messages_ko_back, ...messages_ko_front },
'zh-cn': { ...messages_zh_back, ...messages_zh_front },
},
};

export const availableLanguage: { value: PlatformLang, label: string, name: string }[] = [
{ value: 'de-de', label: 'Deutsch', name: 'German' },
{ value: 'en-us', label: 'English', name: 'English' },
{ value: 'fr-fr', label: 'Français', name: 'French' },
{ value: 'es-es', label: 'Español', name: 'Spanish' },
{ value: 'fr-fr', label: 'Français', name: 'French' },
{ value: 'it-it', label: 'Italiano', name: 'Italian' },
{ value: 'ja-jp', label: '日本語', name: 'Japanese' },
{ value: 'zh-cn', label: '简化字', name: 'Chinese' },
{ value: 'de-de', label: 'Deutsch', name: 'German' },
{ value: 'ko-kr', label: '한국어', name: 'Korean' },
{ value: 'zh-cn', label: '简化字', name: 'Chinese' },
];

// list of available languages for Ai text generation (minimal support : platform languages)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@ import { isNil } from 'ramda';
import { parse } from '../utils/Time';

const dateTimeFormatsMap = {
'de-de': 'dd.MM.yyyy HH:mm',
'en-us': 'yyyy-MM-dd hh:mm a',
'fr-fr': 'dd/MM/yyyy HH:mm',
'es-es': 'dd/MM/yyyy HH:mm',
'fr-fr': 'dd/MM/yyyy HH:mm',
'it-it': 'dd/MM/yyyy HH:mm',
'ja-jp': 'yyyy/MM/dd hh:mm a',
'zg-cn': 'yyyy-MM-dd hh:mm a',
'ko-kr': 'yyyy-MM-dd hh:mm a',
'zh-cn': 'yyyy-MM-dd hh:mm a',
};

const dateTimeFormatsMapWithSeconds = {
'de-de': 'dd.MM.yyyy HH:mm:ss',
'en-us': 'yyyy-MM-dd hh:mm:ss a',
'fr-fr': 'dd/MM/yyyy HH:mm:ss',
'es-es': 'dd/MM/yyyy HH:mm:ss',
'fr-fr': 'dd/MM/yyyy HH:mm:ss',
'it-it': 'dd/MM/yyyy HH:mm:ss',
'ja-jp': 'yyyy/MM/dd hh:mm:ss a',
'zg-cn': 'yyyy-MM-dd hh:mm:ss a',
'ko-kr': 'yyyy-MM-dd hh:mm:ss a',
'zh-cn': 'yyyy-MM-dd hh:mm:ss a',
};

const DateTimePickerField = (props) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,25 @@ import { useIntl } from 'react-intl';
import { parse } from '../utils/Time';

const timeFormatsMap = {
'de-de': 'HH:mm',
'en-us': 'hh:mm a',
'fr-fr': 'HH:mm',
'es-es': 'HH:mm',
'fr-fr': 'HH:mm',
'it-it': 'HH:mm',
'ja-jp': 'hh:mm a',
'zh-cn': 'hh:mm a',
'de-de': 'HH:mm',
'ko-kr': 'hh:mm a',
'zh-cn': 'hh:mm a',
};

const timeFormatsMapWithSeconds = {
'de-de': 'HH:mm:ss',
'en-us': 'hh:mm:ss a',
'fr-fr': 'HH:mm:ss',
'es-es': 'HH:mm:ss',
'fr-fr': 'HH:mm:ss',
'it-it': 'HH:mm:ss',
'ja-jp': 'hh:mm:ss a',
'zh-cn': 'hh:mm:ss a',
'de-de': 'HH:mm:ss',
'ko-kr': 'hh:mm:ss a',
'zh-cn': 'hh:mm:ss a',
};

const TimePickerField = (props) => {
Expand Down
14 changes: 8 additions & 6 deletions opencti-platform/opencti-front/src/utils/BrowserLanguage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import * as R from 'ramda';

export const LANGUAGES = {
AUTO: 'auto',
CHINESE: 'zh-cn',
ENGLISH: 'en-us',
FRENCH: 'fr-fr',
SPANISH: 'es-es',
JAPANESE: 'ja-jp',
CHINESE: 'zh-cn',
GERMAN: 'de-de',
ITALIAN: 'it-it',
JAPANESE: 'ja-jp',
KOREAN: 'ko-kr',
SPANISH: 'es-es',
};

export const DEFAULT_LANG = LANGUAGES.ENGLISH;
Expand All @@ -28,13 +29,14 @@ const browserLanguagePropertyKeys = [
];

const availableLanguages = [
LANGUAGES.CHINESE,
LANGUAGES.ENGLISH,
LANGUAGES.FRENCH,
LANGUAGES.SPANISH,
LANGUAGES.JAPANESE,
LANGUAGES.CHINESE,
LANGUAGES.GERMAN,
LANGUAGES.ITALIAN,
LANGUAGES.JAPANESE,
LANGUAGES.KOREAN,
LANGUAGES.SPANISH,
];

const detectedLocale = R.pipe(
Expand Down