Skip to content

Language implementation

Robert Johansson edited this page May 25, 2021 · 1 revision

Language implementation

Format for keys:'navigationbarTypeText'

navigationbar: activities, values, calendar or info depending on location in the navigationbar.

Type: Header, Button, Slider, and other components.

Text: Short description of the text preferably one word.

Some examples:

'valuesHeaderEvaluation'
'activitiesButtonGradeDay'
'activitiesSliderGradeDay'

Keys related to time follows different format.

To get the translation for a weekday, you use the key weekdays and index the day you're looking for (0 is sunday, 6 is saturday).

To get the translation for a month, you use the key months and index the month you're looking for (0 is January, 11 is December).

Some examples:

dict.weekdays[0] // sunday
dict.weekdays[1] // monday
dict.months[0]   // january
dict.months[11]  // december

Get the word with the key 'keyword' in the correct language using :

import { useTranslation } from 'language/LanguageProvider';

const dict = useTranslation();
dict.keyword; // or dict['keyword']

Clone this wiki locally