Skip to content

Commit

Permalink
[UPM-1368]/evgeniy/add uzbek language (binary-com#16556)
Browse files Browse the repository at this point in the history
* chore: [UPM-1368]/evgeniy/add uzbek language

* chore: add uz translation and icon

* chore: update package-lock

* chore: revert package-lock

* chore: update package-lock

* fix: table alignment for languages

* chore: update translation file

* fix: p2p buy button

* fix: notification button width

* chore: fix smarttrader fail issue (#52)

* chore: update translation strings

* fix: test

* chore: update package-lock

* fix: json error

* refactor: pull lang from localstorage

* chore: trigger build

* chore: revert package-lock

* chore: update package-lock

---------

Co-authored-by: Sui Sin <103026762+suisin-deriv@users.noreply.github.com>
  • Loading branch information
yauheni-deriv and suisin-deriv committed Sep 20, 2024
1 parent efed114 commit 18f8611
Show file tree
Hide file tree
Showing 19 changed files with 3,253 additions and 896 deletions.
4,075 changes: 3,211 additions & 864 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"dependencies": {
"@binary-com/binary-document-uploader": "^2.4.8",
"@deriv-com/analytics": "1.14.0",
"@deriv-com/translations": "1.3.5",
"@deriv-com/translations": "1.3.9",
"@deriv-com/utils": "^0.0.25",
"@deriv-com/ui": "1.35.0",
"@deriv/api": "^1.0.0",
Expand Down
6 changes: 4 additions & 2 deletions packages/api-v2/src/hooks/useOnfido.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCallback, useRef, useMemo, useEffect, useState } from 'react';
import { LocalStorageUtils } from '@deriv-com/utils';
import useOnfidoServiceToken from './useOnfidoServiceToken';
import { ALPHA_2_TO_ALPHA_3, ONFIDO_PHRASES } from '../constants';
import useSettings from './useSettings';
Expand Down Expand Up @@ -96,14 +97,15 @@ const useOnfido = (country?: string, selectedDocument?: string) => {
);

const initOnfido = useCallback(async () => {
const i18NLanguage = window.localStorage.getItem('i18n_language')?.toLowerCase() ?? 'en';
const localizeLanguage = LocalStorageUtils.getValue<string>('i18n_language');
const i18NLanguage = localizeLanguage || 'en';
const onfidoCountryCode =
countryCode.length !== 3 ? ALPHA_2_TO_ALPHA_3[countryCode.toUpperCase()] : countryCode;
try {
onfidoRef.current = await window.Onfido.init({
containerId: onfidoContainerId,
language: {
locale: i18NLanguage,
locale: i18NLanguage.toLowerCase(),
phrases: ONFIDO_PHRASES,
mobilePhrases: ONFIDO_PHRASES,
},
Expand Down
7 changes: 5 additions & 2 deletions packages/api/src/hooks/useOnfido.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCallback, useRef, useMemo, useEffect, useState } from 'react';
import { LocalStorageUtils } from '@deriv-com/utils';
import useOnfidoServiceToken from './useOnfidoServiceToken';
import { ALPHA_2_TO_ALPHA_3, ONFIDO_PHRASES } from '../constants';
import useSettings from './useSettings';
Expand Down Expand Up @@ -96,14 +97,16 @@ const useOnfido = (country?: string, selectedDocument?: string) => {
);

const initOnfido = useCallback(async () => {
const i18NLanguage = window.localStorage.getItem('i18n_language')?.toLowerCase() ?? 'en';
const localizeLanguage = LocalStorageUtils.getValue<string>('i18n_language');
const i18NLanguage = localizeLanguage || 'en';

const onfidoCountryCode =
countryCode.length !== 3 ? ALPHA_2_TO_ALPHA_3[countryCode.toUpperCase()] : countryCode;
try {
onfidoRef.current = await window.Onfido.init({
containerId: onfidoContainerId,
language: {
locale: i18NLanguage,
locale: i18NLanguage.toLowerCase(),
phrases: ONFIDO_PHRASES,
mobilePhrases: ONFIDO_PHRASES,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/appstore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"license": "Apache-2.0",
"dependencies": {
"@deriv-com/analytics": "1.14.0",
"@deriv-com/translations": "1.3.5",
"@deriv-com/translations": "1.3.9",
"@deriv-com/ui": "1.35.0",
"@deriv/account": "^1.0.0",
"@deriv/cashier": "^1.0.0",
Expand Down
11 changes: 6 additions & 5 deletions packages/appstore/src/components/cfds-listing/cfds-listing.scss
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,8 @@

@include mobile-or-tablet-screen {
grid-template-columns: 1fr;
margin: 0 6.5rem 3rem;
margin: 0 auto 3rem;
min-width: 20rem;
}
}

Expand All @@ -989,19 +990,19 @@
}

&-row {
grid-template-columns: 1fr 0.5fr 1.25fr;
grid-template-columns: 1fr 1fr 1.4fr;
justify-items: center;
border-bottom: 0;
padding: 0.4rem 0;
padding: 0.4rem;
background-color: var(--general-hover);
}
}

&-row {
grid-template-columns: 1fr 0.5fr 1.25fr;
grid-template-columns: 1fr 1fr 1.4fr;
justify-items: center;
border-bottom: 0;
padding: 0.4rem 0;
padding: 0.4rem;

&:nth-child(even) {
background-color: var(--general-hover);
Expand Down
2 changes: 1 addition & 1 deletion packages/cfd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"dependencies": {
"@deriv-com/ui": "1.35.0",
"@deriv-com/analytics": "1.14.0",
"@deriv-com/translations": "1.3.5",
"@deriv-com/translations": "1.3.9",
"@deriv-com/utils": "^0.0.25",
"@deriv/account": "^1.0.0",
"@deriv/api": "^1.0.0",
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/components/icon/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,6 @@ import './option/ic-option-over-under.svg';
import './option/ic-option-raise-fall.svg';
import './option/ic-option-touch-notouch.svg';
import './option/ic-option-up-down-asian.svg';
import './rebranding/ic-rebranding-binary-bot.svg';
import './rebranding/ic-rebranding-ctrader-dashboard.svg';
import './rebranding/ic-rebranding-deriv-bot-dashboard.svg';
import './rebranding/ic-rebranding-deriv-bot.svg';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"@deriv-com/analytics": "1.14.0",
"@deriv-com/quill-tokens": "^2.0.4",
"@deriv-com/quill-ui": "1.16.9",
"@deriv-com/translations": "1.3.5",
"@deriv-com/translations": "1.3.9",
"@deriv-com/ui": "1.35.0",
"@deriv-com/utils": "^0.0.25",
"@deriv/account": "^1.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const languages = {
RU: 'Русский',
SI: 'සිංහල',
TR: 'Türkçe',
UZ: "O'zbek",
VI: 'Tiếng Việt',
ZH_CN: '简体中文',
ZH_TW: '繁體中文',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
margin-top: 1.6rem;
height: 24px;
width: fit-content;
max-width: 25rem; // minimum required to fit in long FR, ES & PT text
max-width: 27rem;
align-self: flex-end;
}
&__text-container {
Expand Down
2 changes: 2 additions & 0 deletions packages/p2p/src/components/i18next/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import ru from 'Translations/ru.json';
import si from 'Translations/si.json';
import th from 'Translations/th.json';
import tr from 'Translations/tr.json';
import uz from 'Translations/uz.json';
import vi from 'Translations/vi.json';
import zh_cn from 'Translations/zh_cn.json';
import zh_tw from 'Translations/zh_tw.json';
Expand Down Expand Up @@ -59,6 +60,7 @@ const i18n_config = {
SI: { translations: { ...si } },
TH: { translations: { ...th } },
TR: { translations: { ...tr } },
UZ: { translations: { ...uz } },
VI: { translations: { ...vi } },
ZH_CN: { translations: { ...zh_cn } },
ZH_TW: { translations: { ...zh_tw } },
Expand Down
1 change: 1 addition & 0 deletions packages/p2p/src/pages/buy-sell/buy-sell-row.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
max-height: 7rem;
margin-left: auto;
padding: 1rem 1.6rem;
text-wrap: nowrap;

@include tablet-screen {
justify-self: flex-end;
Expand Down
1 change: 1 addition & 0 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@deriv/quill-icons": "1.23.3",
"@deriv/api-types": "1.0.172",
"@deriv/translations": "^1.0.0",
"@deriv-com/utils": "^0.0.25",
"@types/js-cookie": "^2.2.1",
"@types/react-loadable": "^5.5.6",
"canvas-toBlob": "^1.0.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/utils/constants/translation-flag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
FlagThailandIcon,
FlagTurkeyIcon,
FlagUnitedKingdomIcon,
FlagUzbekistanIcon,
FlagVietnamIcon,
} from '@deriv/quill-icons';

Expand All @@ -41,6 +42,7 @@ const flagComponents = {
SI: FlagSriLankaIcon,
SW: FlagTanzaniaIcon,
TR: FlagTurkeyIcon,
UZ: FlagUzbekistanIcon,
VI: FlagVietnamIcon,
ZH_CN: FlagChinaSimplifiedIcon,
ZH_TW: FlagChinaTraditionalIcon,
Expand Down
11 changes: 7 additions & 4 deletions packages/shared/src/utils/url/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { LocalStorageUtils, URLUtils } from '@deriv-com/utils';
import { deriv_urls } from './constants';

/**
Expand All @@ -22,8 +23,9 @@ export const getActionFromUrl = () => {

export const getUrlSmartTrader = () => {
const { is_staging_deriv_app } = getPlatformFromUrl();
const url_lang = getlangFromUrl();
const i18n_language = window.localStorage.getItem('i18n_language') || url_lang || 'en';
const localize_language = LocalStorageUtils.getValue<string>('i18n_language');
const url_lang = URLUtils.getQueryParameter('lang');
const i18n_language = localize_language || url_lang || 'en';

let base_link = '';

Expand All @@ -39,8 +41,9 @@ export const getUrlSmartTrader = () => {
export const getUrlP2P = (is_language_required = true) => {
const { is_staging_deriv_app } = getPlatformFromUrl();

const url_lang = getlangFromUrl();
const i18n_language = window.localStorage.getItem('i18n_language') || url_lang || 'en';
const localize_language = LocalStorageUtils.getValue<string>('i18n_language');
const url_lang = URLUtils.getQueryParameter('lang');
const i18n_language = localize_language || url_lang || 'en';
const base_link = is_staging_deriv_app ? deriv_urls.P2P_STAGING : deriv_urls.P2P_PRODUCTION;

return is_language_required ? `${base_link}/?l=${i18n_language.toLowerCase()}` : base_link;
Expand Down
2 changes: 2 additions & 0 deletions packages/translations/src/i18next/i18next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const ALL_LANGUAGES = Object.freeze({
RU: 'Русский',
SI: 'සිංහල',
TR: 'Türkçe',
UZ: "O'zbek",
VI: 'Tiếng Việt',
ZH_CN: '简体中文',
ZH_TW: '繁體中文',
Expand All @@ -49,6 +50,7 @@ export const getAllowedLanguages = () => {
SI: 'සිංහල',
TH: 'ไทย',
TR: 'Türkçe',
UZ: "O'zbek",
VI: 'Tiếng Việt',
ZH_CN: '简体中文',
ZH_TW: '繁體中文',
Expand Down
2 changes: 1 addition & 1 deletion packages/wallets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"@deriv-com/analytics": "1.14.0",
"@deriv-com/translations": "1.3.5",
"@deriv-com/translations": "1.3.9",
"@deriv-com/ui": "1.35.0",
"@deriv-com/utils": "^0.0.25",
"@deriv/api-v2": "^1.0.0",
Expand Down
17 changes: 5 additions & 12 deletions packages/wallets/src/helpers/urls.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { LocalStorageUtils, URLUtils } from '@deriv-com/utils';

const isBrowser = () => typeof window !== 'undefined';

const derivComUrl = 'deriv.com';
Expand Down Expand Up @@ -31,16 +33,6 @@ let defaultLanguage: string;
*/
export const normalizePath = (path: string) => (path ? path.replace(/(^\/|\/$|[^a-zA-Z0-9-_./()#])/g, '') : '');

/**
* @deprecated Please use 'URLUtils.getQueryParameter' from '@deriv-com/utils' instead of this.
*/
export const getlangFromUrl = () => {
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const lang = urlParams.get('lang');
return lang;
};

/**
* @deprecated Please use 'URLUtils.getQueryParameter' from '@deriv-com/utils' instead of this.
*/
Expand All @@ -53,8 +45,9 @@ export const getActionFromUrl = () => {

export const getUrlSmartTrader = () => {
const { isStagingDerivApp } = getPlatformFromUrl();
const urlLang = getlangFromUrl();
const i18NLanguage = window.localStorage.getItem('i18n_language') || urlLang || 'en';
const localizeLanguage = LocalStorageUtils.getValue<string>('i18n_language');
const urlLang = URLUtils.getQueryParameter('lang');
const i18NLanguage = localizeLanguage || urlLang || 'en';

let baseLink = '';

Expand Down

0 comments on commit 18f8611

Please sign in to comment.