How to test a website with multiple languages using katalon studio

Hello team,
I want to test a website which is in 8 different languages Liike eng, dich, German etc. Is there any to test this kind of web using katalon studio within the easy way.

Hi, I’m currently facing a similar issue. My solution is to create an Excel file with all the translations (expected texts) and import them to “Data Files”. Then I’ll create variables for all the text elements I want to verify and load the data from the Data File. I have a test case to start the test and there I’ll select the language and write it to a GlobalVariable (GlobalVariable.translation).

Example:

if(GlobalVariable.language == 'english') {
	GlobalVariable.translation = findTestData('translations/english')
}

if (GlobalVariable.language == 'german') {
	GlobalVariable.translation= findTestData('translations/german')
}

In the test case itself I’ll create the variables like this:

//this is so I don't have to write GlobalVariable.language all the time
def T = GlobalVariable.language

title = T.getValue(3, 3)
linkStuff = T.getValue(3, 4)
buttonDoSomething = T.getValue(3, 5)

WebUI.verifyElementText(findTestObject('elementsl/title'), title)
WebUI.verifyElementText(findTestObject('elementsl/Link Stuff'), linkStuff)
WebUI.verifyElementText(findTestObject('elementsl/Button Something'), buttonDoSomething)
2 Likes

If you have access to the translation files and if they are json files there’s an even more convenient solution because you don’t need to use an Excel file. You can just refer to the translations in the file so when translations are added or removed you don’t mess up your Excel file and have to set the row and column numbers again.
Get the json files and put them in a folder, e.g. “translations”.

Here’s the code I put in the test case I use to start the test:

import groovy.json.JsonSlurper as JsonSlurper

if (GlobalVariable.language == "german") {
GlobalVariable.language = "./translations/de.json"
}

if (GlobalVariable.language == "english") {
GlobalVariable.language = "./translations/en.json"
}

GlobalVariable.inputFile = new File(GlobalVariable.language)
GlobalVariable.dict = new JsonSlurper().parseText(GlobalVariable.inputFile.text)

In the test files for the assertions it’s quite similar to the method I described before

// just to make it easier
DICT = GlobalVariable.dict

// set your variables according to the json structure

title = DICT.main.title

description = DICT.main.description

WebUI.verifyElementText(findTestObject('main/title'), title)

WebUI.verifyElementText(findTestObject('main/description'), description)

1 Like

Hello guys I have an upcoming project which should be tested in different languages, does this solution solve the issue? @Bhupendra_Patidar1