|
|
d1d5a8 |
#!/bin/bash
|
|
|
d1d5a8 |
#
|
|
|
d1d5a8 |
# locale_updateMessageShell.sh -- This function parses shell scripts
|
|
|
80bc6f |
# source files under action value and retrives translatable strings in
|
|
|
80bc6f |
# order to creates/updates both the portable object template (.pot)
|
|
|
80bc6f |
# and the portable object (.po) related.
|
|
|
d1d5a8 |
#
|
|
|
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
|
|
|
d1d5a8 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
d1d5a8 |
# General Public License for more details.
|
|
|
d1d5a8 |
#
|
|
|
d1d5a8 |
# You should have received a copy of the GNU General Public License
|
|
|
d1d5a8 |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
d1d5a8 |
# ----------------------------------------------------------------------
|
|
|
d1d5a8 |
# $Id$
|
|
|
d1d5a8 |
# ----------------------------------------------------------------------
|
|
|
d1d5a8 |
|
|
|
d1d5a8 |
function locale_updateMessageShell {
|
|
|
d1d5a8 |
|
|
|
fef984 |
# Print separator line.
|
|
|
510fad |
cli_printMessage '-' --as-separator-line
|
|
|
fef984 |
|
|
|
8632de |
# Define absolute path to file used as reference to create
|
|
|
8632de |
# portable object templates (.pot), portable objects (.po) and
|
|
|
8632de |
# machine objects (.mo).
|
|
|
8632de |
local MESSAGES="${L10N_WORKDIR}/${TEXTDOMAIN}"
|
|
|
18e1a5 |
|
|
|
8632de |
# Define regular expression to match extensions of shell scripts
|
|
|
8632de |
# we use inside the repository.
|
|
|
18e1a5 |
local EXTENSION='sh'
|
|
|
d1d5a8 |
|
|
|
80bc6f |
# Build list of files to process. When building the patter, be
|
|
|
80bc6f |
# sure the value passed through `--filter' be exactly evaluated
|
|
|
80bc6f |
# with the extension as prefix. Otherwise it would be difficult to
|
|
|
80bc6f |
# match files that share the same characters in their file names
|
|
|
80bc6f |
# (e.g., it would be difficult to match only `hello.sh' if
|
|
|
80bc6f |
# `hello-world.sh' also exists in the same location).
|
|
|
8632de |
local FILES=$(cli_getFilesList ${ACTIONVAL} --pattern="${FLAG_FILTER}\.${EXTENSION}")
|
|
|
d1d5a8 |
|
|
|
d1d5a8 |
# Print action message.
|
|
|
8632de |
cli_printMessage "${MESSAGES}.pot" --as-updating-line
|
|
|
d1d5a8 |
|
|
|
d241e1 |
# Retrive translatable strings from shell script files and create
|
|
|
d241e1 |
# the portable object template (.pot) from them.
|
|
|
8632de |
xgettext --output=${MESSAGES}.pot \
|
|
|
80bc6f |
--copyright-holder="The CentOS L10n SIG" \
|
|
|
d1d5a8 |
--width=70 --sort-by-file ${FILES}
|
|
|
d1d5a8 |
|
|
|
a3ed58 |
# Sanitate metadata inside the POT file.
|
|
|
8632de |
locale_updateMessageMetadata "${MESSAGES}.pot"
|
|
|
d421d4 |
|
|
|
d241e1 |
# Verify, initialize or update portable objects from portable
|
|
|
d241e1 |
# object templates.
|
|
|
8632de |
locale_updateMessagePObjects "${MESSAGES}"
|
|
|
d1d5a8 |
|
|
|
d1d5a8 |
}
|