Internationalisation
As explained in the previous pages, each screen is quite customisable and configurable. When it comes to Personal details and ID details, you have noticed that the fields are wrapped within a country object by default.
On this page, we will explain how you can use a country object to have a specific customisation per country/state for different fields, which will allow you to meet different requirements for each country you want to launch for.
Country object
Countries
is an array of different country objects:
Attribute | Description |
---|---|
countries: | array of country object |
And each country object starts with a country_code
followed by a set of state_code
:
<country_code>:{
<state_code>:{
...
},
<state_code>:{
...
},
}
Attribute | Description |
---|---|
country_code | Three digits country code: If not applicable, use default as the key. |
state_code | State code for the specific country. If not applicable, use default as the key |
`fields [ ] | An array of field object |
And for each state, you can have an array of data_field
object. This object is a common strcuture across all the Personal and ID input fields. There are some pre-defined fields available that you can use as explained for each screen, but you can also define any custom field.
Field object
Attribute | Description | Values |
---|---|---|
fieldType* | “input”|”select”|”dob”|”address”|”phone” | |
name * | “first_name”|”middle_name”|”last_name” | ”dob” | ”address” | ”license_number” |”card_number” | ”version_number” | “passport_number” | |
dataType | “phone” | “email” | “individual_extra”|“document_extra” | “previous_addr” | “current_addr” | |
style | ||
label | displayed label for the field | |
helperText | the text displayed under the field for additional info | |
placeholder | the text displayed inside the field as a sample input | |
hide | true/false |
rules
[not applicable to "dob" field].
Attribute | Description | Values |
---|---|---|
required | ||
required.value | true/false | |
required.value | ||
minLength | ||
minLength.value | integer | |
minLength.message | ||
maxLength | ||
maxLength.value | integer | |
regex.value | string - regex type /^([+-])(\d{2}):(\d{2})$/ Alphabetic → /^[A-Za-z]+$/ | |
regex.message |
options
: array
[applicable to "select" field]
Attribute | Description | Values |
---|---|---|
label | ||
value |
calendar
[applicable to "select" field]
Attribute | Description | Values |
---|---|---|
calendar.type | “Gregorian” | “Budhist” | |
local | ||
day | ||
day.required | ||
month | ||
month.required | ||
year | ||
year.required |
age
[applicable to “dob” field]
Attribute | Description | Values |
---|---|---|
min | integer | |
max | integer | |
message |
Sample
Default countries
Default fields for all countries/states:
"countries": {
"default": {
"default": {
"fields": [
{
"fieldType": "input"
"name": "license_number"
rules:{
},
style: {
ff-form-field:{}
}
},
{
"fieldType": "input"
"name": "card_number"
rules:{
},
style: {
ff-form-field:{}
}
}
],
}
}
}
Overwrite specific countries
Overwrite the config for specific countries/states:
"countries": {
"AUS": {
"VIC": {
"fields": [
{
"fieldType": "input"
"name": "license_number"
rules:{
},
style: {
ff-form-field:{}
}
},
{
"fieldType": "input"
"name": "card_number"
rules:{
},
style: {
ff-form-field:{}
}
},
{
"fieldType": "input"
"name": "registration_number",
style: {
ff-form-field:{}
}
}
]
},
"NSW": {
"fields": [
<data_field>
]
}
}
"NZL": {
"default": {
"fields": [
<data_field>
]
}
}
}
Use countries within documents
documents: {
DRIVERS_LICENSE: {
label:
subtitile:
countries:{
AUS:{
ACT:{
fields:[ <data_field> ],
},
NT:{
fields:[ <data_field> ],
},
Qld:{
fields:[ <data_field> ],
},
....,
[key in other_state]:{
fields:[ <data_field> ],
}
},
NZL:{
default: {
fields:[ <data_field> ],
}
}
},
},
PASSPORT:{...},
MEDICARE: {...},
}
Updated 10 days ago