diff --git a/apps/contract-verification/src/app/app.tsx b/apps/contract-verification/src/app/app.tsx index 0ea4332543..85ebbfb19b 100644 --- a/apps/contract-verification/src/app/app.tsx +++ b/apps/contract-verification/src/app/app.tsx @@ -13,6 +13,7 @@ import { CompilerAbstract } from '@remix-project/remix-solidity' import { useLocalStorage } from './hooks/useLocalStorage' import { getVerifier } from './Verifiers' import { ContractDropdownSelection } from './components/ContractDropdown' +import { IntlProvider } from 'react-intl' const plugin = new ContractVerificationPluginClient() @@ -32,11 +33,25 @@ const App = () => { const [proxyAddressError, setProxyAddressError] = useState('') const [abiEncodedConstructorArgs, setAbiEncodedConstructorArgs] = useState('') const [abiEncodingError, setAbiEncodingError] = useState('') + const [locale, setLocale] = useState<{ code: string; messages: any }>({ + code: 'en', + messages: {} + }) const timer = useRef(null) useEffect(() => { plugin.internalEvents.on('verification_activated', () => { + + // @ts-ignore + plugin.call('locale', 'currentLocale').then((locale: any) => { + setLocale(locale) + }) + + // @ts-ignore + plugin.on('locale', 'localeChanged', (locale: any) => { + setLocale(locale) + }) // Fetch compiler artefacts initially plugin.call('compilerArtefacts' as any, 'getAllCompilerAbstracts').then((obj: any) => { setCompilationOutput(obj) @@ -143,11 +158,13 @@ const App = () => { }, [submittedContracts]) return ( - - - - - + + + + + + + ) } diff --git a/apps/contract-verification/src/app/components/ContractAddressInput.tsx b/apps/contract-verification/src/app/components/ContractAddressInput.tsx index 5eb6e73d1e..ef0af854b0 100644 --- a/apps/contract-verification/src/app/components/ContractAddressInput.tsx +++ b/apps/contract-verification/src/app/components/ContractAddressInput.tsx @@ -2,11 +2,11 @@ import React, { useEffect, useState, useContext } from 'react' import { ethers } from 'ethers/' interface ContractAddressInputProps { - label: string + label: string | any id: string contractAddress: string setContractAddress: (address: string) => void - contractAddressError: string + contractAddressError: string | any setContractAddressError: (error: string) => void } diff --git a/apps/contract-verification/src/app/components/NavMenu.tsx b/apps/contract-verification/src/app/components/NavMenu.tsx index d835e1a193..22e5199f5a 100644 --- a/apps/contract-verification/src/app/components/NavMenu.tsx +++ b/apps/contract-verification/src/app/components/NavMenu.tsx @@ -1,13 +1,15 @@ import React from 'react' import { NavLink } from 'react-router-dom' +import { useIntl, FormattedMessage } from 'react-intl' interface NavItemProps { to: string icon: JSX.Element - title: string + title: string | any } const NavItem: React.FC = ({ to, icon, title }) => { + const intl = useIntl() return ( = ({ to, icon, title }) => { export const NavMenu = () => { return ( -