Blame Scripts/Functions/Locale/locale_updateMessageBinary.sh

b2e671
#!/bin/bash
b2e671
#
b2e671
# locale_updateMessageBinary.sh -- This function creates/updates
b2e671
# machine objects (.mo) from portable objects (.po).
b2e671
#
2fe9b7
# Copyright (C) 2009, 2010, 2011 The CentOS Project
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
b2e671
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
b2e671
# General Public License for more details.
b2e671
#
b2e671
# You should have received a copy of the GNU General Public License
b2e671
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
b2e671
# ----------------------------------------------------------------------
b2e671
# $Id$
b2e671
# ----------------------------------------------------------------------
b2e671
b2e671
function locale_updateMessageBinary {
b2e671
b2e671
    # Verify machine object creation flag.
0d4faa
    if [[ ${FLAG_DONT_CREATE_MO} == 'true' ]];then
b2e671
        return
b2e671
    fi
b2e671
216915
    # Define absolute path to portable object file.
216915
    local PO_FILE="$1"
b2e671
216915
    # Verify existence of portable object file.
216915
    cli_checkFiles "${PO_FILE}"
b2e671
216915
    # Define absolute path to machine object directory.
216915
    local MO_DIR="${L10N_WORKDIR}/LC_MESSAGES"
b2e671
216915
    # Define absolute path to machine object file.
216915
    local MO_FILE="${MO_DIR}/${CLI_PROGRAM}.sh.mo"
b2e671
216915
    # Print action message.
216915
    cli_printMessage "${MO_FILE}" --as-creating-line
b2e671
216915
    # Verify absolute path to machine object directory, if it doesn't
216915
    # exist create it.
216915
    if [[ ! -d ${MO_DIR} ]];then
216915
        mkdir -p ${MO_DIR}
216915
    fi
b2e671
    
216915
    # Create machine object from portable object.
216915
    msgfmt --check ${PO_FILE} --output-file=${MO_FILE}
b2e671
b2e671
}