adding i18n to contract verification

pull/5591/head
Joseph Izang 1 month ago
parent a909343b98
commit 42325417cd
  1. 17
      apps/contract-verification/src/app/app.tsx
  2. 4
      apps/contract-verification/src/app/components/ContractAddressInput.tsx
  3. 12
      apps/contract-verification/src/app/components/NavMenu.tsx
  4. 4
      apps/contract-verification/src/app/layouts/Default.tsx
  5. 6
      apps/remix-ide/src/app/tabs/locales/en/contractverification.json
  6. 6
      apps/remix-ide/src/app/tabs/locales/es/contractverification.json
  7. 6
      apps/remix-ide/src/app/tabs/locales/fr/contractverification.json
  8. 6
      apps/remix-ide/src/app/tabs/locales/it/contractverification.json
  9. 6
      apps/remix-ide/src/app/tabs/locales/ko/contractverification.json
  10. 6
      apps/remix-ide/src/app/tabs/locales/ru/contractverification.json
  11. 6
      apps/remix-ide/src/app/tabs/locales/zh/contractverification.json

@ -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<string>('')
const [abiEncodingError, setAbiEncodingError] = useState<string>('')
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 (
<IntlProvider locale={locale.code} messages={locale.messages}>
<AppContext.Provider value={{ themeType, setThemeType, clientInstance: plugin, settings, setSettings, chains, compilationOutput, submittedContracts, setSubmittedContracts }}>
<VerifyFormContext.Provider value={{ selectedChain, setSelectedChain, contractAddress, setContractAddress, contractAddressError, setContractAddressError, selectedContract, setSelectedContract, proxyAddress, setProxyAddress, proxyAddressError, setProxyAddressError, abiEncodedConstructorArgs, setAbiEncodedConstructorArgs, abiEncodingError, setAbiEncodingError }}>
<DisplayRoutes />
</VerifyFormContext.Provider>
</AppContext.Provider>
</IntlProvider>
)
}

@ -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
}

@ -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<NavItemProps> = ({ to, icon, title }) => {
const intl = useIntl()
return (
<NavLink
data-id={`${title}Tab`}
@ -25,10 +27,10 @@ const NavItem: React.FC<NavItemProps> = ({ to, icon, title }) => {
export const NavMenu = () => {
return (
<nav className="d-flex medium flex-row w-100" style={{ backgroundColor: 'var(--body-bg)!important' }}>
<NavItem to="/" icon={<i className="fas fa-home"></i>} title="Verify" />
<NavItem to="/receipts" icon={<i className="fas fa-receipt"></i>} title="Receipts" />
<NavItem to="/lookup" icon={<i className="fas fa-search"></i>} title="Lookup" />
<NavItem to="/settings" icon={<i className="fas fa-cog"></i>} title="Settings" />
<NavItem to="/" icon={<i className="fas fa-home"></i>} title={ <FormattedMessage id="contractverification.verifyNavTitle" /> } />
<NavItem to="/receipts" icon={<i className="fas fa-receipt"></i>} title={ <FormattedMessage id="contractverification.receiptsNavTitle" /> } />
<NavItem to="/lookup" icon={<i className="fas fa-search"></i>} title={ <FormattedMessage id="contractverification.lookupNavTitle" /> } />
<NavItem to="/settings" icon={<i className="fas fa-cog"></i>} title={ <FormattedMessage id="contractverification.settingsNavTitle" /> } />
</nav>
)
}

@ -4,8 +4,8 @@ import { NavMenu } from '../components/NavMenu'
interface Props {
from: string
title?: string
description?: string
title?: string | any
description?: string | any
}
export const DefaultLayout = ({ children, title, description }: PropsWithChildren<Props>) => {

@ -0,0 +1,6 @@
{
"contractverification.verifyNavTitle": "Verify",
"contractverification.receiptsNavTitle": "Receipts",
"contractverification.lookupNavTitle": "Lookup",
"contractverification.settingsNavTitle": "Settings"
}

@ -0,0 +1,6 @@
{
"contractverification.verifyNavTitle": "Verificar",
"contractverification.receiptsNavTitle": "Receipts",
"contractverification.lookupNavTitle": "Lookups",
"contractverification.settingsNavTitle": "Settings"
}

@ -0,0 +1,6 @@
{
"contractverification.verifyNavTitle": "Verifiers",
"contractverification.receiptsNavTitle": "Receipts",
"contractverification.lookupNavTitle": "Lookups",
"contractverification.settingsNavTitle": "Settings"
}

@ -0,0 +1,6 @@
{
"contractverification.verifyNavTitle": "Verifiers",
"contractverification.receiptsNavTitle": "Receipts",
"contractverification.lookupNavTitle": "Lookups",
"contractverification.settingsNavTitle": "Settings"
}

@ -0,0 +1,6 @@
{
"contractverification.verifyNavTitle": "Verifiers",
"contractverification.receiptsNavTitle": "Receipts",
"contractverification.lookupNavTitle": "Lookups",
"contractverification.settingsNavTitle": "Settings"
}

@ -0,0 +1,6 @@
{
"contractverification.verifyNavTitle": "Verifiers",
"contractverification.receiptsNavTitle": "Receipts",
"contractverification.lookupNavTitle": "Lookups",
"contractverification.settingsNavTitle": "Settings"
}

@ -0,0 +1,6 @@
{
"contractverification.verifyNavTitle": "Verifiers",
"contractverification.receiptsNavTitle": "Receipts",
"contractverification.lookupNavTitle": "Lookups",
"contractverification.settingsNavTitle": "Settings"
}
Loading…
Cancel
Save