Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/components/scenes/RampKycFormScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useHandler } from '../../hooks/useHandler'
import { lstrings } from '../../locales/strings'
import { GuiFormField } from '../../plugins/gui/components/GuiFormField'
import { GuiFormRow } from '../../plugins/gui/components/GuiFormRow'
import { useSelector } from '../../types/reactRedux'
import type { BuySellTabSceneProps } from '../../types/routerTypes'
import { ErrorCard } from '../cards/ErrorCard'
import { SceneWrapper } from '../common/SceneWrapper'
Expand Down Expand Up @@ -59,6 +60,12 @@ export const RampKycFormScene = React.memo((props: Props) => {
onCancel
} = params

const countryCode = useSelector(state => state.ui.settings.countryCode)
const stateFieldLabel =
countryCode === 'US'
? lstrings.form_field_title_address_state
: lstrings.form_field_title_address_state_province_region
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing Localized String for State Field

The code uses lstrings.form_field_title_address_state for US users, but this string key only exists in English locale files (en_US.ts and enUS.json). When a US user accesses this form with a non-English language setting, the string key will be undefined in those locale files (e.g., de.json, es.json), causing the field label to display as undefined or cause an error. The string key needs to be added to all supported locale files, or a fallback should be implemented.

Fix in Cursor Fix in Web


const [firstName, setFirstName] = React.useState(initialFirstName)
const [lastName, setLastName] = React.useState(initialLastName)
const [email, setEmail] = React.useState(initialEmail)
Expand Down Expand Up @@ -231,7 +238,7 @@ export const RampKycFormScene = React.memo((props: Props) => {
<GuiFormField
fieldType="state"
value={state}
label={lstrings.form_field_title_address_state_province_region}
label={stateFieldLabel}
onChangeText={handleStateInput}
onSubmitEditing={handleStateSubmit}
returnKeyType="next"
Expand Down
1 change: 1 addition & 0 deletions src/locales/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1825,6 +1825,7 @@ const strings = {
form_field_title_street_name: 'Street Name',
form_field_title_apt_unit_number: 'Apt/Unit # (optional)',
form_field_title_address_state_province_region: 'Province',
form_field_title_address_state: 'State',
form_field_title_address_zip_postal_code: 'Postal Code/Zip',
form_field_title_email_address: 'Email Address',
form_field_title_first_name: 'First Name',
Expand Down
1 change: 1 addition & 0 deletions src/locales/strings/enUS.json
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,7 @@
"form_field_title_street_name": "Street Name",
"form_field_title_apt_unit_number": "Apt/Unit # (optional)",
"form_field_title_address_state_province_region": "Province",
"form_field_title_address_state": "State",
"form_field_title_address_zip_postal_code": "Postal Code/Zip",
"form_field_title_email_address": "Email Address",
"form_field_title_first_name": "First Name",
Expand Down
Loading