From a49093962ec07a158d41df83b5b58af37c8e376e Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Tue, 16 Jun 2020 16:14:38 +0200 Subject: [PATCH] Add i18n apply button (#2968) --- packages/page-settings/src/I18n/index.tsx | 13 +++++++++++++ packages/react-components/src/i18n/index.ts | 10 +++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/page-settings/src/I18n/index.tsx b/packages/page-settings/src/I18n/index.tsx index dd5457ad32..7d17781711 100644 --- a/packages/page-settings/src/I18n/index.tsx +++ b/packages/page-settings/src/I18n/index.tsx @@ -6,6 +6,7 @@ import FileSaver from 'file-saver'; import React, { useCallback, useEffect, useState } from 'react'; import styled from 'styled-components'; import { Button, Columar, Column, Dropdown, Progress, Spinner, Toggle } from '@polkadot/react-components'; +import i18n from '@polkadot/react-components/i18n'; import languageCache from '@polkadot/react-components/i18n/cache'; import { useToggle } from '@polkadot/react-hooks'; import uiSettings from '@polkadot/ui-settings'; @@ -185,6 +186,13 @@ function Translate ({ className }: Props): React.ReactElement { [english, lng] ); + const _doApply = useCallback( + (): void => { + i18n.reloadResources().catch(console.error); + }, + [] + ); + const _onDownload = useCallback( () => doDownload(strings || {}, withEmpty), [strings, withEmpty] @@ -242,6 +250,11 @@ function Translate ({ className }: Props): React.ReactElement { /> +