diff --git a/docs/intro.md b/docs/intro.md index f8087ed7e..a6a39f1e9 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -51,13 +51,13 @@ Our Documentation is divided in several sections: - Have a look at the Core concepts pages and take your + Have a look at the Core concepts pages and take your time to read through it. These concepts will help you get familiar with our WebSocket server api and how to use it more efficiently. They are not related to any of our frameworks or libraries. - When you read through the Core concepts page, you can + When you read through the Core concepts page, you can start choosing your implementation approach based on the language, framework or library you want to use in your application. @@ -65,7 +65,7 @@ Our Documentation is divided in several sections:

Code Examples

If you want to know how you can implement our API within your code, then we suggest to have a look -at our Code examples. These code examples come in +at our Code examples. These code examples come in `CodeSandboxes`. This allows you to easily fork the code examples and experiment with them for personal use. For now we only have JavaScript code examples, but, we plan to add more examples that are created with different languages, frameworks and libraries in the near future. @@ -76,7 +76,7 @@ that are created with different languages, frameworks and libraries in the near When using our code examples, we also suggest to have a look at our{' '} - Languages section. Here, we describe in detail how you + Languages section. Here, we describe in detail how you can setup your personal project properly to make use of our API. This will surely come helpful when you try to integrate some of our code examples in your own project. @@ -88,7 +88,7 @@ that are created with different languages, frameworks and libraries in the near If you want to know for example how you can `monetize your application` or how to create a `secure way for users to log in` to your application, then we provide a handful of{' '} - Guides that can assist you with that. + Guides that can assist you with that. @@ -98,5 +98,5 @@ that are created with different languages, frameworks and libraries in the near If you want to know more about the essentials that are needed to setup your own application, then have a look at the{' '} - Setting up a Deriv application section. + Setting up a Deriv application section. diff --git a/docs/setting-up-a-deriv-application.md b/docs/setting-up-a-deriv-application.md index 97bb2f3de..711c5b271 100644 --- a/docs/setting-up-a-deriv-application.md +++ b/docs/setting-up-a-deriv-application.md @@ -16,9 +16,9 @@ description: A step-by-step guide on creating your Deriv API token and building #### Deriv account -If you don't have a Deriv account yet, you can easily create one by visiting our signup page or using the new_account_virtual API call. It's completely free. And if you have an account already, please log in using your account details. To avoid any accidental loss of funds during testing, we recommend using your demo account instead of a real account. +If you don't have a Deriv account yet, you can easily create one by visiting our signup page or using the new_account_virtual API call. It's completely free. And if you have an account already, please log in using your account details. To avoid any accidental loss of funds during testing, we recommend using your demo account instead of a real account. -To earn markup, get a Deriv real account to receive your monthly earnings. You can also create a real account using new_account_real or new_account_maltainvest API calls. +To earn markup, get a Deriv real account to receive your monthly earnings. You can also create a real account using new_account_real or new_account_maltainvest API calls. :::caution To create Deriv applications, you'll need an API token with the Admin scope for the account you wish to use for your application. @@ -34,7 +34,7 @@ To create a new API token, follow these steps: 2. Provide a name for your token 3. Click **Create** -Alternatively, you can create an API token via the api_token API call. +Alternatively, you can create an API token via the api_token API call. :::caution You need a token with the `Admin` scope to create an application. diff --git a/src/components/Footer/index.tsx b/src/components/Footer/index.tsx index 354f02222..12ab0e522 100644 --- a/src/components/Footer/index.tsx +++ b/src/components/Footer/index.tsx @@ -40,6 +40,12 @@ const Footer = () => { if you have any questions. + + {/* This script is only for enabling crowdin in context tool. Should be removed once translation is ready! */} + + ); }; diff --git a/src/configs/websocket/index.ts b/src/configs/websocket/index.ts index d07354615..67f700c81 100644 --- a/src/configs/websocket/index.ts +++ b/src/configs/websocket/index.ts @@ -8,6 +8,7 @@ import { } from './types'; import { Observable } from 'rxjs'; import { getIsBrowser, getServerConfig } from '@site/src/utils'; +import { getCurrentLanguage } from '@site/src/utils/language-utils'; export type TDerivApi = { send: (...requestData: unknown[]) => Promise; @@ -38,7 +39,9 @@ export class ApiManager { public init() { if (!this.socket) { const { serverUrl, appId } = getServerConfig(); - this.socket = new WebSocket(`wss://${serverUrl}/websockets/v3?app_id=${appId}`); + this.socket = new WebSocket( + `wss://${serverUrl}/websockets/v3?app_id=${appId}&l=${getCurrentLanguage()}`, + ); } this.derivApi = new DerivAPIBasic({ connection: this.socket }); this.registerKeepAlive(); diff --git a/src/features/Endpoint/Endpoint.tsx b/src/features/Endpoint/Endpoint.tsx index 90e5778a3..508d2d684 100644 --- a/src/features/Endpoint/Endpoint.tsx +++ b/src/features/Endpoint/Endpoint.tsx @@ -5,6 +5,7 @@ import { getAppId } from '@site/src/utils'; import { DEFAULT_WS_SERVER } from '@site/src/utils/constants'; import styles from './Endpoint.module.scss'; import Translate, { translate } from '@docusaurus/Translate'; +import { getCurrentLanguage } from '@site/src/utils/language-utils'; interface IEndpointFormValues { app_id: string; @@ -44,7 +45,7 @@ const EndPoint = () => { const server_url = localStorage.getItem('config.server_url') ?? default_endpoint.server_url; const app_id = localStorage.getItem('config.app_id') ?? default_endpoint.app_id; - const current_url = `wss://${server_url}/websockets/v3?app_id=${app_id}&l=EN&brand=deriv`; + const current_url = `wss://${server_url}/websockets/v3?app_id=${app_id}&l=${getCurrentLanguage()}&brand=deriv`; return ( diff --git a/src/features/dashboard/components/Dialogs/RegisterAppDialogError/index.tsx b/src/features/dashboard/components/Dialogs/RegisterAppDialogError/index.tsx index 09de2216c..2b774b3c6 100644 --- a/src/features/dashboard/components/Dialogs/RegisterAppDialogError/index.tsx +++ b/src/features/dashboard/components/Dialogs/RegisterAppDialogError/index.tsx @@ -19,7 +19,7 @@ export const RegisterAppDialogError = ({ error, onClose }: TRegisterAppDialogErr const actionButtons: TModalActionButton[] = [ { id: 1, - text: 'Got it', + text: translate({ message: 'Got it' }), color: 'secondary', onClick: () => { onClose(); diff --git a/src/pages/auth.tsx b/src/pages/auth.tsx index 14f84e064..c50261acd 100644 --- a/src/pages/auth.tsx +++ b/src/pages/auth.tsx @@ -3,7 +3,7 @@ import Layout from '@theme/Layout'; import { Login } from '../features/Auth/Login/Login'; import useAuthParams from '../hooks/useAuthParams'; import { useEffect } from 'react'; -import { Redirect, useLocation } from '@docusaurus/router'; +import { useLocation } from '@docusaurus/router'; import useAuthContext from '../hooks/useAuthContext'; export default function Auth(): JSX.Element { diff --git a/src/utils/language-utils.ts b/src/utils/language-utils.ts new file mode 100644 index 000000000..c4961d359 --- /dev/null +++ b/src/utils/language-utils.ts @@ -0,0 +1,9 @@ +export const locales = ['en', 'fr']; + +export const getCurrentLanguage = () => { + const path = window.location.pathname; + const currentLocale = locales.find( + (locale) => path.startsWith(`/${locale}/`) || path === `/${locale}`, + ); + return currentLocale ?? 'en'; +};