Skip to content

Commit bdb44e0

Browse files
committed
added translations in some missed elements
1 parent 3470f1a commit bdb44e0

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

apps/contract-verification/src/app/components/ConfigInput.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useEffect, useState } from 'react'
22
import { CustomTooltip } from '@remix-ui/helper'
3-
import { FormattedMessage } from 'react-intl'
3+
import { FormattedMessage, useIntl } from 'react-intl'
44

55
interface ConfigInputProps {
66
label: string
@@ -14,6 +14,7 @@ interface ConfigInputProps {
1414
export const ConfigInput: React.FC<ConfigInputProps> = ({ label, id, secret, initialValue, saveResult }) => {
1515
const [value, setValue] = useState(initialValue)
1616
const [enabled, setEnabled] = useState(false)
17+
const intl = useIntl()
1718

1819
// Reset state when initialValue changes
1920
useEffect(() => {
@@ -43,10 +44,7 @@ export const ConfigInput: React.FC<ConfigInputProps> = ({ label, id, secret, ini
4344
type={secret ? 'password' : 'text'}
4445
className={`form-control small w-100 ${!enabled ? 'bg-transparent pl-0 border-0' : ''}`}
4546
id={id}
46-
placeholder={`${<FormattedMessage id="contract-verification.configInputPlaceholder" defaultMessage="Enter API Key"
47-
values={{
48-
label: label
49-
}} />}`}
47+
placeholder={intl.formatMessage({ id: "contract-verification.configInputPlaceholder", defaultMessage: "Enter API Key" }, { label })}
5048
value={value}
5149
onChange={(e) => setValue(e.target.value)}
5250
disabled={!enabled}

apps/contract-verification/src/app/components/ConstructorArguments.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ethers } from 'ethers'
33

44
import { AppContext } from '../AppContext'
55
import { ContractDropdownSelection } from './ContractDropdown'
6+
import { FormattedMessage } from 'react-intl'
67

78
interface ConstructorArgumentsProps {
89
abiEncodedConstructorArgs: string
@@ -102,7 +103,10 @@ export const ConstructorArguments: React.FC<ConstructorArgumentsProps> = ({ abiE
102103
<div className="d-flex py-1 align-items-center custom-control custom-checkbox">
103104
<input className="form-check-input custom-control-input" type="checkbox" id="toggleRawInputSwitch" checked={toggleRawInput} onChange={() => setToggleRawInput(!toggleRawInput)} />
104105
<label className="m-0 form-check-label custom-control-label" style={{ paddingTop: '2px' }} htmlFor="toggleRawInputSwitch">
105-
Enter raw ABI-encoded constructor arguments
106+
<FormattedMessage
107+
id="contract-verification.constructorArgumentsToggleRawInput"
108+
defaultMessage="Enter raw ABI-encoded constructor arguments"
109+
/>
106110
</label>
107111
</div>
108112
{toggleRawInput ? (
@@ -122,7 +126,10 @@ export const ConstructorArguments: React.FC<ConstructorArgumentsProps> = ({ abiE
122126
{abiEncodedConstructorArgs && (
123127
<div>
124128
<label className="form-check-label" htmlFor="rawAbiEncodingResult">
125-
ABI-encoded constructor arguments:
129+
<FormattedMessage
130+
id="contract-verification.constructorArgumentsRawAbiEncodingResult"
131+
defaultMessage="ABI-encoded constructor arguments"
132+
/> :
126133
</label>
127134
<textarea className="form-control" rows={5} disabled value={abiEncodedConstructorArgs} id="rawAbiEncodingResult" style={{ opacity: 0.5 }} />
128135
</div>

apps/contract-verification/src/app/components/ContractDropdown.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useEffect, useState, useContext, Fragment } from 'react'
22
import './ContractDropdown.css'
33
import { AppContext } from '../AppContext'
4+
import { FormattedMessage } from 'react-intl'
45

56
export interface ContractDropdownSelection {
67
triggerFilePath: string
@@ -42,7 +43,7 @@ export const ContractDropdown: React.FC<ContractDropdownProps> = ({ label, id, s
4243

4344
return (
4445
<div className="form-group">
45-
<label htmlFor={id}>{label}</label>
46+
<label htmlFor={id}><FormattedMessage id="contract-verification.contractDropdownLabel" defaultMessage={label} values={{ label }} /></label>
4647
<select value={selectedContract ? JSON.stringify(selectedContract) : ''}
4748
className={`form-control custom-select pr-4 ${!hasContracts ? 'disabled-cursor text-warning' : ''}`}
4849
id={id}

apps/contract-verification/src/app/components/SearchableChainDropdown.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useState, useEffect, useRef, useMemo } from 'react'
22
import Fuse from 'fuse.js'
33
import type { Chain } from '../types'
44
import { AppContext } from '../AppContext'
5+
import { useIntl } from 'react-intl'
56

67
function getChainDescriptor(chain: Chain): string {
78
if (!chain) return ''
@@ -18,6 +19,7 @@ interface DropdownProps {
1819
export const SearchableChainDropdown: React.FC<DropdownProps> = ({ label, id, setSelectedChain, selectedChain }) => {
1920
const { chains } = React.useContext(AppContext)
2021
const ethereumChainIds = [1, 11155111, 17000]
22+
const intl = useIntl()
2123

2224
// Add Ethereum chains to the head of the chains list. Sort the rest alphabetically
2325
const dropdownChains = useMemo(
@@ -90,7 +92,7 @@ export const SearchableChainDropdown: React.FC<DropdownProps> = ({ label, id, se
9092
{' '}
9193
{/* Add ref here */}
9294
<label htmlFor={id}>{label}</label>
93-
<input type="text" value={searchTerm} onChange={handleInputChange} onClick={openDropdown} data-id="chainDropdownbox" placeholder="Select a chain" className="form-control" />
95+
<input type="text" value={searchTerm} onChange={handleInputChange} onClick={openDropdown} data-id="chainDropdownbox" placeholder={intl.formatMessage({ id: "contract-verification.searchableChainDropdown", defaultMessage: "Select a chain" })} className="form-control" />
9496
<ul className="dropdown-menu show w-100 bg-light" style={{ maxHeight: '400px', overflowY: 'auto', display: isOpen ? 'initial' : 'none' }}>
9597
{filteredOptions.map((chain) => (
9698
<li key={chain.chainId} onClick={() => handleOptionClick(chain)} data-id={chain.chainId} className={`dropdown-item text-dark ${selectedChain?.chainId === chain.chainId ? 'active' : ''}`} style={{ cursor: 'pointer', whiteSpace: 'normal' }}>

apps/remix-ide/src/app/tabs/locales/en/contractverification.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
"contract-verification.settingsDefaultLayout.description": "Customize settings for each verification service and chain",
2121
"contract-verification.configInputPlaceholderText": "Add {label}",
2222
"contract-verification.configInputSaveButton": "Save",
23-
"contract-verification.configInputCancelButton": "Cancel"
23+
"contract-verification.configInputCancelButton": "Cancel",
24+
"contract-verification.constructorArgumentsToggleRawInput": "Enter raw ABI-encoded constructor arguments",
25+
"contract-verification.constructorArgumentsRawAbiEncodingResult": "ABI-encoded constructor arguments",
26+
"contract-verification.contractDropdownLabel": "{label}"
2427
}
2528

2629

0 commit comments

Comments
 (0)