Blame Scripts/Functions/cli_getLangCodes.sh

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