Languages

For applications that support multiple languages, Sente has a language translation feature to ensure that the test runs easily in different languages.

Working with Multiple Languages

The Languages directory contains the translation files. The default translation files are en for English and tr for Turkish.

Generate a new language for translation

use sente new command

sente new

Add new translation key

  1. Open language file

  2. Add translations to all language files

For example, let's translate an error message given in a failed login into different languages; Write a key like login_failed and translate it into all language files.

Set Current Language

current_language configuration is crucial for setting and switching between languages effectively.

current_language is defined as a key in the environment configs

Usage in test

To use it in the test, the translate(<key>) method is used.

const { sente } = require('#libraries');
const { translate } = sente;

translate('LOGIN_FAILED');

Last updated