Answer for changed question:
You can pass parameter to the function
function FetchCategories($currentLang){
$order = 'category';
if ($currentLang == 'en') {
$order = 'categoryen';
}
// Get categories array
$categories = $this->dbh->getAll("select id,category,categoryen from ".TABLE_PREFIX."categories order by {$order}", DB_FETCHMODE_ASSOC);
return $categories;
}
And then you need to run your function fetchCategories($lang)
where $lang is your current language
or if you can use LANGUAGE_ID constant in your function you can do it that way:
function FetchCategories(){
$order = 'category';
if (LANGUAGE_ID == 'en') {
$order = 'categoryen';
}
// Get categories array
$categories = $this->dbh->getAll("select id,category,categoryen from ".TABLE_PREFIX."categories order by {$order}", DB_FETCHMODE_ASSOC);
return $categories;
}