Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

Commit

Permalink
translation for contacts
Browse files Browse the repository at this point in the history
  • Loading branch information
kendricktan committed Oct 22, 2017
1 parent 4c1529e commit b12a8a6
Show file tree
Hide file tree
Showing 16 changed files with 278 additions and 137 deletions.
24 changes: 17 additions & 7 deletions src/containers/ContactsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ import {
ToolbarButton
} from 'react-onsenui'

const getContactDetails = (navigator, addContact, deleteContact, contactName, contactAddress) => {
import TRANSLATIONS from '../translations'

const getContactDetails = (curLang, navigator, addContact, deleteContact, contactName, contactAddress) => {
// Language
const nameLang = TRANSLATIONS[curLang].ContactsPage.contactsName
const addressLang = TRANSLATIONS[curLang].ContactsPage.contactsAddress

// Local style
const inputStyle = {
width: '95%',
Expand Down Expand Up @@ -77,7 +83,7 @@ const getContactDetails = (navigator, addContact, deleteContact, contactName, co
<Input
style={inputStyle}
value={tmpContactName}
placeholder='Contact Name'
placeholder={nameLang}
float
onChange={(e) => { tmpContactName = e.target.value }}
/>
Expand All @@ -86,7 +92,7 @@ const getContactDetails = (navigator, addContact, deleteContact, contactName, co
<Input
style={inputStyle}
value={tmpContactAddress}
placeholder='Contact Address'
placeholder={addressLang}
float
onChange={(e) => { tmpContactAddress = e.target.value }}
/>
Expand All @@ -104,13 +110,15 @@ class ContactsPage extends React.Component {
}

renderToolbar () {
const contactLang = TRANSLATIONS[this.props.settings.language].ContactsPage.contacts

return (
<Toolbar>
<div className='left'>
<BackButton onClick={() => this.props.navigator.popPage()}>Back</BackButton>
</div>
<div className='center'>
Contacts
{contactLang}
</div>
</Toolbar>
)
Expand All @@ -120,7 +128,7 @@ class ContactsPage extends React.Component {
return (
<Fab
position='bottom right'
onClick={() => this.gotoComponent(getContactDetails(this.props.navigator, this.props.addContact, this.props.deleteContact, '', ''))}>
onClick={() => this.gotoComponent(getContactDetails(this.props.settings.language, this.props.navigator, this.props.addContact, this.props.deleteContact, '', ''))}>
<Icon icon='ion-plus'/>
</Fab>
)
Expand All @@ -145,7 +153,7 @@ class ContactsPage extends React.Component {
}).map((c, idx) => {
return (
<ListItem key={idx}
onClick={this.gotoComponent.bind(this, getContactDetails(this.props.navigator, this.props.addContact, this.props.deleteContact, c.name, c.address))}
onClick={this.gotoComponent.bind(this, getContactDetails(this.props.settings.language, this.props.navigator, this.props.addContact, this.props.deleteContact, c.name, c.address))}
tappable>
{c.name}
</ListItem>
Expand All @@ -159,6 +167,7 @@ class ContactsPage extends React.Component {
}

ContactsPage.propTypes = {
language: PropTypes.object.isRequired,
settings: PropTypes.object.isRequired,
navigator: PropTypes.object.isRequired,
contacts: PropTypes.array.isRequired,
Expand All @@ -168,7 +177,8 @@ ContactsPage.propTypes = {

function mapStateToProps (state) {
return {
contacts: state.contacts
contacts: state.contacts,
settings: state.settings
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/containers/SendPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ class SendPage extends React.Component {
const txSuccessfulLang = TRANSLATIONS[CUR_LANG].SendPage.txSuccessful
const confirmSendLang = TRANSLATIONS[CUR_LANG].SendPage.confirmSend

const contactLang = TRANSLATIONS[CUR_LANG].ContactsPage.contacts

return (
<Page
style={pageStyle}
Expand Down Expand Up @@ -434,7 +436,7 @@ class SendPage extends React.Component {
})
}))
}}>
Contacts
{contactLang}
</Button></h3>
<Input
onChange={(e) => this.setState({ addressReceive: e.target.value })}
Expand Down
5 changes: 5 additions & 0 deletions src/translations/Afrikaans.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,10 @@ export const AFRIKAANS_TRANSLATION: TRANSLATION_OBJ = {
pinsNotSimilar: 'PINs wat ingevoer word, stem nie ooreen nie',
invalidPin: 'Ongeldige PIN',
enterYourPin: 'Voer U PIN in'
},
ContactsPage: {
contacts: 'Contacts',
contactsName: 'Name',
contactsAddress: 'Address'
}
}
5 changes: 5 additions & 0 deletions src/translations/English.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,10 @@ export const ENGLISH_TRANSLATION: TRANSLATION_OBJ = {
pinsNotSimilar: 'PINs entered do not match',
invalidPin: 'Invalid PIN',
enterYourPin: 'Enter your PIN'
},
ContactsPage: {
contacts: 'Contacts',
contactsName: 'Name',
contactsAddress: 'Address'
}
}
5 changes: 5 additions & 0 deletions src/translations/Filipino.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,10 @@ export const FILIPINO_TRANSLATION: TRANSLATION_OBJ = {
pinsNotSimilar: 'Hindi tugma ang PINs na nailagay',
invalidPin: 'Hindi tamang PIN',
enterYourPin: 'Lagay ang iyong PIN'
},
ContactsPage: {
contacts: 'Contacts',
contactsName: 'Name',
contactsAddress: 'Address'
}
}
5 changes: 5 additions & 0 deletions src/translations/French.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,10 @@ export const FRENCH_TRANSLATION: TRANSLATION_OBJ = {
pinsNotSimilar: 'Les codes PIN entrés ne correspondent pas',
invalidPin: 'Code PIN invalide',
enterYourPin: 'Entrez votre code PIN'
},
ContactsPage: {
contacts: 'Contacts',
contactsName: 'Name',
contactsAddress: 'Address'
}
}
5 changes: 5 additions & 0 deletions src/translations/German.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,10 @@ export const GERMAN_TRANSLATION: TRANSLATION_OBJ = {
pinsNotSimilar: 'PINs stimmen nicht überein',
invalidPin: 'Ungültige PIN',
enterYourPin: 'PIN Eingeben'
},
ContactsPage: {
contacts: 'Contacts',
contactsName: 'Name',
contactsAddress: 'Address'
}
}
5 changes: 5 additions & 0 deletions src/translations/Indonesian.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,10 @@ export const INDONESIAN_TRANSLATION: TRANSLATION_OBJ = {
pinsNotSimilar: 'PIN yang dimasukkan tidak cocok',
invalidPin: 'PIN tidak valid',
enterYourPin: 'Masukkan PIN Anda'
},
ContactsPage: {
contacts: 'Contacts',
contactsName: 'Name',
contactsAddress: 'Address'
}
}
5 changes: 5 additions & 0 deletions src/translations/Portuguese.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,10 @@ export const PORTUGUESE_TRANSLATION: TRANSLATION_OBJ = {
pinsNotSimilar: 'PINs digitados não conferem',
invalidPin: 'PIN Inválido',
enterYourPin: 'Digite seu PIN'
},
ContactsPage: {
contacts: 'Contacts',
contactsName: 'Name',
contactsAddress: 'Address'
}
}
5 changes: 5 additions & 0 deletions src/translations/Russian.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,10 @@ export const RUSSIAN_TRANSLATION: TRANSLATION_OBJ = {
pinsNotSimilar: 'Введеные PIN-ы не совпадают',
invalidPin: 'Неверный PIN',
enterYourPin: 'Введите PIN'
},
ContactsPage: {
contacts: 'Contacts',
contactsName: 'Name',
contactsAddress: 'Address'
}
}
5 changes: 5 additions & 0 deletions src/translations/Serbian.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,10 @@ export const SERBIAN_TRANSLATION: TRANSLATION_OBJ = {
pinsNotSimilar: 'Uneti PINovi se ne slažu',
invalidPin: 'Nevažeći PIN',
enterYourPin: 'Unesite vaš PIN'
},
ContactsPage: {
contacts: 'Contacts',
contactsName: 'Name',
contactsAddress: 'Address'
}
}
5 changes: 5 additions & 0 deletions src/translations/Spanish.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,10 @@ export const SPANISH_TRANSLATION: TRANSLATION_OBJ = {
pinsNotSimilar: 'Los PINs introducidos no coinciden',
invalidPin: 'PIN Inválido',
enterYourPin: 'Ingrese su PIN'
},
ContactsPage: {
contacts: 'Contacts',
contactsName: 'Name',
contactsAddress: 'Address'
}
}
5 changes: 5 additions & 0 deletions src/translations/Swedish.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,10 @@ export const SWEDISH_TRANSLATION: TRANSLATION_OBJ = {
pinsNotSimilar: 'Dina inskrivna PIN matchar inte',
invalidPin: 'Ogiltig PIN',
enterYourPin: 'Skriv in din PIN'
},
ContactsPage: {
contacts: 'Contacts',
contactsName: 'Name',
contactsAddress: 'Address'
}
}
5 changes: 5 additions & 0 deletions src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ export type TRANSLATION_OBJ = {
pinsNotSimilar: string,
invalidPin: string,
enterYourPin: string
},
ContactsPage: {
contacts: string,
contactsName: string,
contactsAddress: string
}
}

Expand Down
Loading

0 comments on commit b12a8a6

Please sign in to comment.