-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Help Translate
You must create an issue first about what language you want to add so a conflict could be avoidable.
To get started, fork the automa repository and clone it into your local machine. Create a new branch called dev
and switch to the dev
branch.
To start translating the extension, navigate to the src/locales
directory, duplicate the en
folder and rename it to your targeted language. For the name, you can follow the ISO 639-1 code.
In the folder, you'll find JSON files. You can open these files and start translating. You only need to translate the properties of the JSON, for example
{
"home": {
"viewAll": "View all"
}
}
Into
{
"home": {
"viewAll": "Lihat semua"
}
}
And don't translate a word inside a curly bracket, like {name}
; {count}
; etc.
After you have translated all the JSON files, you need to register the language to the extension. Open the src/utils/shared.js
file, and at the very bottom, you'll find the supportLocales
variable. The id
key is the name of the folder that you have added in the src/locales
directory and the name
key for the name of the language. And it will look like this
export const supportLocales = [
{ id: 'en', name: 'English' },
{ id: 'id', name: 'Bahasa Indonesia' }
];
Open the src/lib/dayjs.js
file and after the import relativeTime from 'dayjs/plugin/relativeTime';
line. Add import 'dayjs/locale/langId'
code, replace the langId
with the id of the language. You can find the id of the language in the dayjs supported locales page
Before adding a pull request, commit the changes in your local repository first. The message of the commit must follow the conventional commit, and in this case, it will look like this
feat(locale): add langId locale
then push it to the dev
branch of your remote repository.
And you can do pull request into the automa repository