Blame Scripts/Bash/Functions/cli_getLangCodes.sh

878a2b
#!/bin/bash
878a2b
#
878a2b
# cli_getLangCodes.sh -- This function outputs a list with language
878a2b
# codes as defined in ISO639 standard.
878a2b
#
878a2b
# Copyright (C) 2009, 2010, 2011 The CentOS Project
878a2b
#
878a2b
# This program is free software; you can redistribute it and/or modify
878a2b
# it under the terms of the GNU General Public License as published by
878a2b
# the Free Software Foundation; either version 2 of the License, or (at
878a2b
# your option) any later version.
878a2b
#
878a2b
# This program is distributed in the hope that it will be useful, but
878a2b
# WITHOUT ANY WARRANTY; without even the implied warranty of
878a2b
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
878a2b
# General Public License for more details.
878a2b
#
878a2b
# You should have received a copy of the GNU General Public License
878a2b
# along with this program; if not, write to the Free Software
878a2b
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
878a2b
#
878a2b
# ----------------------------------------------------------------------
878a2b
# $Id$
878a2b
# ----------------------------------------------------------------------
878a2b
878a2b
function cli_getLangCodes {
878a2b
878a2b
    local FILTER="$(echo $1 | cut -d_ -f1)"
878a2b
878a2b
    LANGCODES="aa
878a2b
        ab 
878a2b
        ae 
878a2b
        af 
878a2b
        ak 
878a2b
        am 
878a2b
        an 
878a2b
        ar 
878a2b
        as 
878a2b
        av 
878a2b
        ay 
878a2b
        az 
878a2b
        ba 
878a2b
        be 
878a2b
        bg 
878a2b
        bh 
878a2b
        bi 
878a2b
        bm 
878a2b
        bn 
878a2b
        bo 
878a2b
        br 
878a2b
        bs 
878a2b
        ca 
878a2b
        ce 
878a2b
        ch 
878a2b
        co 
878a2b
        cr 
878a2b
        cs 
878a2b
        cu 
878a2b
        cv 
878a2b
        cy 
878a2b
        da 
878a2b
        de 
878a2b
        dv 
878a2b
        dz 
878a2b
        ee 
878a2b
        el 
878a2b
        en 
878a2b
        eo 
878a2b
        es 
878a2b
        et 
878a2b
        eu 
878a2b
        fa 
878a2b
        ff 
878a2b
        fi 
878a2b
        fj 
878a2b
        fo 
878a2b
        fr 
878a2b
        fy 
878a2b
        ga 
878a2b
        gd 
878a2b
        gl 
878a2b
        gn 
878a2b
        gu 
878a2b
        gv 
878a2b
        ha 
878a2b
        he 
878a2b
        hi 
878a2b
        ho 
878a2b
        hr 
878a2b
        ht 
878a2b
        hu 
878a2b
        hy 
878a2b
        hz 
878a2b
        ia 
878a2b
        id 
878a2b
        ie 
878a2b
        ig 
878a2b
        ii 
878a2b
        ik 
878a2b
        io 
878a2b
        is 
878a2b
        it 
878a2b
        iu 
878a2b
        ja 
878a2b
        jv 
878a2b
        ka 
878a2b
        kg 
878a2b
        ki 
878a2b
        kj 
878a2b
        kk 
878a2b
        kl 
878a2b
        km 
878a2b
        kn 
878a2b
        ko 
878a2b
        kr 
878a2b
        ks 
878a2b
        ku 
878a2b
        kv 
878a2b
        kw 
878a2b
        ky 
878a2b
        la 
878a2b
        lb 
878a2b
        lg 
878a2b
        li 
878a2b
        ln 
878a2b
        lo 
878a2b
        lt 
878a2b
        lu 
878a2b
        lv 
878a2b
        mg 
878a2b
        mh 
878a2b
        mi 
878a2b
        mk 
878a2b
        ml 
878a2b
        mn 
878a2b
        mo 
878a2b
        mr 
878a2b
        ms 
878a2b
        mt 
878a2b
        my 
878a2b
        na 
878a2b
        nb 
878a2b
        nd 
878a2b
        ne 
878a2b
        ng 
878a2b
        nl 
878a2b
        nn 
878a2b
        no 
878a2b
        nr 
878a2b
        nv 
878a2b
        ny 
878a2b
        oc 
878a2b
        oj 
878a2b
        om 
878a2b
        or 
878a2b
        os 
878a2b
        pa 
878a2b
        pi 
878a2b
        pl 
878a2b
        ps 
878a2b
        pt 
878a2b
        qu 
878a2b
        rm 
878a2b
        rn 
878a2b
        ro 
878a2b
        ru 
878a2b
        rw 
878a2b
        sa 
878a2b
        sc 
878a2b
        sd 
878a2b
        se 
878a2b
        sg 
878a2b
        si 
878a2b
        sk 
878a2b
        sl 
878a2b
        sm 
878a2b
        sn 
878a2b
        so 
878a2b
        sq 
878a2b
        sr 
878a2b
        ss 
878a2b
        st 
878a2b
        su 
878a2b
        sv 
878a2b
        sw 
878a2b
        ta 
878a2b
        te 
878a2b
        tg 
878a2b
        th 
878a2b
        ti 
878a2b
        tk 
878a2b
        tl 
878a2b
        tn 
878a2b
        to 
878a2b
        tr 
878a2b
        ts 
878a2b
        tt 
878a2b
        tw 
878a2b
        ty 
878a2b
        ug 
878a2b
        uk 
878a2b
        ur 
878a2b
        uz 
878a2b
        ve 
878a2b
        vi 
878a2b
        vo 
878a2b
        wa 
878a2b
        wo 
878a2b
        xh 
878a2b
        yi 
878a2b
        yo 
878a2b
        za 
878a2b
        zh 
878a2b
        zu"
878a2b
878a2b
    if [[ $FILTER != '' ]];then
878a2b
        echo "$LANGCODES" | egrep "$FILTER" | sed -r 's![[:space:]]+!!g'
878a2b
    else
878a2b
        echo "$LANGCODES"
878a2b
    fi
878a2b
878a2b
}