使用php将文本翻译成不同的语言

Basically, I am trying to translate a few texts to Chinese from the default language french. The following code states the translation from one language to another language but I am confused with the part of having the text translated to more than one language in PHP. Any help would be appreciated

<?php
$icl = ICL_LANGUAGE_CODE;
$placeholder = $icl == 'fr' ? 'Sélectionner une filiale' : 'Select an affiliate';
$all = $icl == 'fr' ? 'Toutes les filiales' : 'All affiliates';
$filter = $icl == 'fr' ? 'Filtrer les offres' : 'Filter offers';
?>

You can do something like this, even if this is not good coding:

<?php
$icl = ICL_LANGUAGE_CODE;
switch ($icl) {
    case 'fr':
        $placeholder = 'Sélectionner une filiale';
        $all = 'Toutes les filiales';
        $filter = 'Filtrer les offres';
        break;

    case 'en':
        $placeholder = 'Select an affiliate';
        $all = 'All affiliates';
        $filter = 'Filter offers';
        break;

    case 'YOUR_LANGUAGE_CODE':
        $placeholder = 'YOUR TRANSLATION FOR PLACEHOLDER';
        $all = 'YOUR TRANSLATION FOR ALL';
        $filter = 'YOUR TRANSLATION FOR FILTER';
        break;
}
?>