You'd use keys to lookup the string values instead of hardcoded them in the tests. The i18next framework has the lookup mechanism and language detection. Here is a tutorial for using i18next in Playwright and Nightwatch test frameworks.