|
|
878a2b |
#!/bin/bash
|
|
|
878a2b |
#
|
|
|
878a2b |
# locale_updateMessageShell.sh -- This function parses shell scripts
|
|
|
878a2b |
# source files under action value and retrives translatable strings in
|
|
|
878a2b |
# order to creates/updates both the portable object template (.pot)
|
|
|
878a2b |
# and the portable object (.po) related.
|
|
|
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 locale_updateMessageShell {
|
|
|
878a2b |
|
|
|
878a2b |
# Print separator line.
|
|
|
878a2b |
cli_printMessage '-' --as-separator-line
|
|
|
878a2b |
|
|
|
878a2b |
# Define absolute path to file used as reference to create
|
|
|
878a2b |
# portable object templates (.pot), portable objects (.po) and
|
|
|
878a2b |
# machine objects (.mo).
|
|
|
878a2b |
local MESSAGES="${L10N_WORKDIR}/${TEXTDOMAIN}"
|
|
|
878a2b |
|
|
|
878a2b |
# Define regular expression to match extensions of shell scripts
|
|
|
878a2b |
# we use inside the repository.
|
|
|
878a2b |
local EXTENSION='sh'
|
|
|
878a2b |
|
|
|
878a2b |
# Build list of files to process. When building the patter, be
|
|
|
878a2b |
# sure the value passed through `--filter' be exactly evaluated
|
|
|
878a2b |
# with the extension as prefix. Otherwise it would be difficult to
|
|
|
878a2b |
# match files that share the same characters in their file names
|
|
|
878a2b |
# (e.g., it would be difficult to match only `hello.sh' if
|
|
|
878a2b |
# `hello-world.sh' also exists in the same location).
|
|
|
878a2b |
local FILES=$(cli_getFilesList ${ACTIONVAL} --pattern="${FLAG_FILTER}\.${EXTENSION}")
|
|
|
878a2b |
|
|
|
878a2b |
# Print action message.
|
|
|
878a2b |
cli_printMessage "${MESSAGES}.pot" --as-updating-line
|
|
|
878a2b |
|
|
|
878a2b |
# Retrive translatable strings from shell script files and create
|
|
|
878a2b |
# the portable object template (.pot) from them.
|
|
|
878a2b |
xgettext --output=${MESSAGES}.pot \
|
|
|
878a2b |
--copyright-holder="The CentOS L10n SIG" \
|
|
|
878a2b |
--width=70 --sort-by-file ${FILES}
|
|
|
878a2b |
|
|
|
878a2b |
# Sanitate metadata inside the POT file.
|
|
|
878a2b |
locale_updateMessageMetadata "${MESSAGES}.pot"
|
|
|
878a2b |
|
|
|
878a2b |
# Verify, initialize or update portable objects from portable
|
|
|
878a2b |
# object templates.
|
|
|
878a2b |
locale_updateMessagePObjects "${MESSAGES}"
|
|
|
878a2b |
|
|
|
878a2b |
}
|