public static function getJsReplacement($trlElement)
    {
        $b = $trlElement['before'];
        $fn = substr($b, 0, strpos($b, '('));
        $key = $trlElement['type'].'.'.$trlElement['source'];
        if (isset($trlElement['context'])) $key .= '.'.$trlElement['context'];
        $key .= '.'.str_replace("'", "\\'", $trlElement['text']);
        $replace = '';
        if (preg_match('#^(_?([a-z]+(2\.default)?\.))trl#i', $b, $m)) {
            $replace = substr($b, 0, strlen($m[1]));
        }
        if ($trlElement['type'] == 'trlp' || $trlElement['type'] == 'trlcp') {
            $replace .= "_kwfTrlp";
        } else {
            $replace .= "_kwfTrl";
        }
        $replace .= "('$key', ".substr($b, strpos($b, '(')+1);

        unset($trlElement['before']);
        unset($trlElement['linenr']);
        unset($trlElement['error_short']);

        return array(
            'before' => $b,
            'replace' => $replace,
            'trlElement' => (object)$trlElement
        );
    }