From 5f643d4f7bb987de8d2aff2cd369411693bf7d02 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Sep 10 2013 18:18:16 +0000 Subject: Update centos-art.sh script's locale module. - Previously, script files do not have a top comment. This was with the intention of reduce the size of files. There were files that the top comment was larger than the code itself. Nevertheless, using the top comment grantee consistency along the script files making them visually connected, they provide a place for quick notes about what each specific file intend to do. The GNU License also says that: Cite: It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. In this commit add the top comment back with function description, writer, copyright and license information in it. - Previously, asciidoc_convertAsciidocToDocbook was passing an empty value through --doctype option because RENDER_FLOW variable is not previously defined. This commit removes the --doctype option altogether and leaves asciidoc to use its default value. - Previsouly, file.sh was poorly documented. Add comments to it. - Previsouly, update_convertXmlToPot was using a cat pipe xml2po construction. This is not necessary becase xml2po accepts a file for processing in its command line. This commit removes the cat pipe construction leaving just xml2po. --- diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Delete/delete.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Delete/delete.sh index 162b823..c6b0cd0 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Delete/delete.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Delete/delete.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# delete.sh -- This module standardizes localization delete actions +# inside the repository. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function delete { diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Edit/edit.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Edit/edit.sh index 3951411..65a613b 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Edit/edit.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Edit/edit.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# edit.sh -- This module standardizes localization edition actions +# inside the repository. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function edit { diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Asciidoc/asciidoc.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Asciidoc/asciidoc.sh index f546628..2c449ea 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Asciidoc/asciidoc.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Asciidoc/asciidoc.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# asciidoc.sh -- This module standardizes localization update actions +# for asciidoc files inside the repository. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function asciidoc { @@ -12,16 +37,14 @@ function asciidoc { # directories. local POT_FILE=${ASCIIDOC_FILE}.pot - tcar_printMessage "${POT_FILE}" --as-creating-line - local DOCBOOK_FILE=$(tcar_getTemporalFile $(basename ${ASCIIDOC_FILE})).docbook + tcar_printMessage "${POT_FILE}" --as-creating-line + asciidoc_convertAsciidocToDocbook update_convertXmlToPot "${DOCBOOK_FILE}" "${POT_FILE}" - # Verify, initialize or merge portable objects from portable - # object templates. update_convertPotToPo "${POT_FILE}" "${PO_FILE}" done diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Asciidoc/asciidoc_convertAsciidocToDocbook.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Asciidoc/asciidoc_convertAsciidocToDocbook.sh index cf6c1e3..106b4ef 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Asciidoc/asciidoc_convertAsciidocToDocbook.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Asciidoc/asciidoc_convertAsciidocToDocbook.sh @@ -1,8 +1,34 @@ #!/bin/bash +###################################################################### +# +# asciidoc_convertAsciidocToDocbook.sh -- This function converts +# asciicoc files into docbook files using asciidoc command's default +# (article) doctype. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function asciidoc_convertAsciidocToDocbook { - /usr/bin/asciidoc --backend="docbook" --doctype="${RENDER_FLOW}" \ + /usr/bin/asciidoc --backend="docbook" \ --out-file=${DOCBOOK_FILE} ${ASCIIDOC_FILE} } diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Sh/sh.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Sh/sh.sh index 4035c57..6745577 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Sh/sh.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Sh/sh.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# sh.sh -- This module standardizes localization update actions for +# bash scripts inside the repository. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function sh { @@ -23,7 +48,7 @@ function sh { # updated PO files here in order for `centos-art.sh' script to # print out the most up to date revision of localized messages. # Notice that this is required only if we were localizing shell - # scripts. + # scripts because xml-based files don't need the MO files. update_convertPoToMo } diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Svg/svg.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Svg/svg.sh index da8323f..15da1eb 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Svg/svg.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Svg/svg.sh @@ -1,10 +1,36 @@ #!/bin/bash +###################################################################### +# +# svg.sh -- This module standardizes localization update actions of +# svg files inside the repository. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function svg { local SVG_FILE='' + local SVG_FILES=${SOURCES[*]} - for SVG_FILE in ${SOURCES[*]};do + for SVG_FILE in ${SVG_FILES};do # Define POT's default location using the source file as # reference. The portable object template is @@ -20,12 +46,8 @@ function svg { update_convertXmlToPot "${SVG_INSTANCE}" "${POT_FILE}" - # Verify, initialize or merge portable objects from portable - # object templates. update_convertPotToPo "${POT_FILE}" "${PO_FILE}" done - - } diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Svg/svg_createSvgInstance.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Svg/svg_createSvgInstance.sh index e8b4089..f41f7f5 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Svg/svg_createSvgInstance.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Update/Modules/Svg/svg_createSvgInstance.sh @@ -1,4 +1,30 @@ #!/bin/bash +###################################################################### +# +# svg_createSvgInstance.sh -- This function verifies whether the +# file being processed is compressed or not, then uses that +# information to read the file and create an instance of it. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function svg_createSvgInstance { diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update.conf.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update.conf.sh index b4677d6..17a178f 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update.conf.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update.conf.sh @@ -1,3 +1,27 @@ -#!/bin/bash +###################################################################### +# +# update.conf.sh -- This file defines environment variables used by +# update module's execution environment. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### declare -x TCAR_SCRIPT_MODULES_BASEDIR=${MODULE_DIR_MODULES} diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update.sh index a611c4e..eb9d2ce 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# update.sh -- This module standardizes update actions related to +# localization inside the repository. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function update { diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_convertPoToMo.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_convertPoToMo.sh index c1898a6..c58637b 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_convertPoToMo.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_convertPoToMo.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# update_convertPoToMo.sh -- This function converts portable object +# (.po) files to machine object (.mo) files. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function update_convertPoToMo { diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_convertPotToPo.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_convertPotToPo.sh index 7d5a854..82f0e71 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_convertPotToPo.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_convertPotToPo.sh @@ -1,4 +1,30 @@ #!/bin/bash +###################################################################### +# +# update_convertPotToPo.sh -- This function takes a portable object +# template (.pot) and creates a language-specific portable object +# (.po) for it. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function update_convertPotToPo { diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_convertXmlToPot.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_convertXmlToPot.sh index 3ba0275..640d468 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_convertXmlToPot.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_convertXmlToPot.sh @@ -1,11 +1,36 @@ #!/bin/bash +###################################################################### +# +# update_convertXmlToPot.sh -- This function takes an XML file and +# creates a portable object template (.pot) for it. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function update_convertXmlToPot { local XML_FILE=${1} local POT_FILE=${2} - cat ${XML_FILE} | xml2po -a -l ${TCAR_SCRIPT_LANG_LC} - \ + xml2po -a -l ${TCAR_SCRIPT_LANG_LC} ${XML_FILE} \ | msgcat --output-file=${POT_FILE} --width=70 --no-location - } diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_getCountryName.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_getCountryName.sh index b7a0609..cbf098d 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_getCountryName.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_getCountryName.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# update_getCountryName.sh -- This function implements country names +# based on country codes as specified by ISO-3166. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function update_getCountryName { diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_getLanguageName.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_getLanguageName.sh index 32879ab..83e684d 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_getLanguageName.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_getLanguageName.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# update_getLanguageName.sh -- This function implements language +# names based on language codes as specified by ISO-639. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function update_getLanguageName { diff --git a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_setPoMetadata.sh b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_setPoMetadata.sh index 3159f5c..0ee4812 100755 --- a/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_setPoMetadata.sh +++ b/Automation/Modules/Locale/Modules/Actions/Modules/Update/update_setPoMetadata.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# update_setPoMetadata -- This function sets metadata to portable +# object (.po) files, using CentOS-specific data. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function update_setPoMetadata { diff --git a/Automation/Modules/Locale/Modules/Actions/actions.conf.sh b/Automation/Modules/Locale/Modules/Actions/actions.conf.sh index d3a5926..74b79b6 100755 --- a/Automation/Modules/Locale/Modules/Actions/actions.conf.sh +++ b/Automation/Modules/Locale/Modules/Actions/actions.conf.sh @@ -1,3 +1,28 @@ #!/bin/bash +###################################################################### +# +# actions.conf.sh -- This file defines environment variables used by +# actions module's execution environment. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### declare -x TCAR_SCRIPT_MODULES_BASEDIR=${MODULE_DIR_MODULES} diff --git a/Automation/Modules/Locale/Modules/Actions/actions.sh b/Automation/Modules/Locale/Modules/Actions/actions.sh index 43dd9d3..8376f3e 100755 --- a/Automation/Modules/Locale/Modules/Actions/actions.sh +++ b/Automation/Modules/Locale/Modules/Actions/actions.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# actions.sh -- This module standardizes localization actions inside +# the repository. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function actions { diff --git a/Automation/Modules/Locale/Modules/Directory/directory.sh b/Automation/Modules/Locale/Modules/Directory/directory.sh index ea6819c..15d1190 100755 --- a/Automation/Modules/Locale/Modules/Directory/directory.sh +++ b/Automation/Modules/Locale/Modules/Directory/directory.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# directory.sh -- This module standardize localization of directory +# structures inside the repository. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function directory { diff --git a/Automation/Modules/Locale/Modules/Directory/directory_getConfiguration.sh b/Automation/Modules/Locale/Modules/Directory/directory_getConfiguration.sh index 432001c..49a2d58 100755 --- a/Automation/Modules/Locale/Modules/Directory/directory_getConfiguration.sh +++ b/Automation/Modules/Locale/Modules/Directory/directory_getConfiguration.sh @@ -1,4 +1,30 @@ #!/bin/bash +###################################################################### +# +# directory_getConfiguration.sh -- This function retrieves +# localization options from configuration files and process them +# accordingly. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function directory_getConfiguration { diff --git a/Automation/Modules/Locale/Modules/File/file.sh b/Automation/Modules/Locale/Modules/File/file.sh index 9ab21eb..740d5a9 100755 --- a/Automation/Modules/Locale/Modules/File/file.sh +++ b/Automation/Modules/Locale/Modules/File/file.sh @@ -1,26 +1,76 @@ #!/bin/bash +###################################################################### +# +# file.sh -- This module standardize localization of files inside +# the repository. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function file { + # Define absolute path to argument passed in the command-line. local FILE=$(tcar_checkRepoDirSource "${1}") + # Verify argument passed in the command-line does exist and is a + # regular file. tcar_checkFiles -ef ${FILE} + # Define file name. local FILE_NAME="$(basename ${FILE})" + # Define file extension. local FILE_EXTENSION=$(echo ${FILE} | sed -r 's/.+\.([[:alnum:]]+)$/\1/') + # Define absolute path to directory holding the files to process. local DIRECTORY=$(dirname ${FILE}) + # Define list of files to process. local RENDER_FROM=$(tcar_getFilesList ${DIRECTORY} \ --pattern="^.+/.+\.${FILE_EXTENSION}$" --type="f") + # Define absolute path to directory holding language-specific + # content. local LOCALE_FROM=${DIRECTORY}/Locales + # Define absolute path to portable and machine objects. local POT_FILE=${LOCALE_FROM}/${FILE_NAME}.pot local PO_FILE=${LOCALE_FROM}/${TCAR_SCRIPT_LANG_LC}/${FILE_NAME}.po local MO_FILE=${LOCALE_FROM}/${TCAR_SCRIPT_LANG_LC}/LC_MESSAGES/${FILE_NAME}.mo - file_getConfiguration + # Define the rendition type you want to perform. + local RENDER_TYPE=${FILE_EXTENSION} + + # Define the translation file you want to use. + local -a TRANSLATIONS + TRANSLATIONS[0]=${PO_FILE} + + # Define translation file. This is from which translatable strings + # will be retrieved. + local -a SOURCES + for SOURCE in ${RENDER_FROM};do + SOURCES[((++${#SOURCES[*]}))]=${SOURCE} + done + + # Process configuration variables through locale's actions module. + tcar_setModuleEnvironment "actions" "${@}" } diff --git a/Automation/Modules/Locale/Modules/File/file_getConfiguration.sh b/Automation/Modules/Locale/Modules/File/file_getConfiguration.sh deleted file mode 100755 index 183a87f..0000000 --- a/Automation/Modules/Locale/Modules/File/file_getConfiguration.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -function file_getConfiguration { - - # Define the rendition do you want to perform. - local RENDER_TYPE=${FILE_EXTENSION} - - # Define the translation file you want to use. - local -a TRANSLATIONS - TRANSLATIONS[0]=${PO_FILE} - - # Define translation file. This is from which translatable strings - # will be retrieved. - local -a SOURCES - for SOURCE in ${RENDER_FROM};do - SOURCES[((++${#SOURCES[*]}))]=${SOURCE} - done - - # Process configuration variables through locale's actions module. - tcar_setModuleEnvironment "actions" "${@}" - -} diff --git a/Automation/Modules/Locale/locale.conf.sh b/Automation/Modules/Locale/locale.conf.sh index 573bc77..5e24bef 100755 --- a/Automation/Modules/Locale/locale.conf.sh +++ b/Automation/Modules/Locale/locale.conf.sh @@ -1,5 +1,30 @@ #!/bin/bash +###################################################################### +# +# locale.conf.sh -- This file defines environment variables used by +# locale module's execution environment. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### declare -xr MODULE_VERSION='0.1' -declare -x ACTIONS='' -declare -x TCAR_SCRIPT_MODULES_BASEDIR=${MODULE_DIR_MODULES} +declare -x ACTIONS='' +declare -x TCAR_SCRIPT_MODULES_BASEDIR=${MODULE_DIR_MODULES} diff --git a/Automation/Modules/Locale/locale.sh b/Automation/Modules/Locale/locale.sh index fcda0c7..a5720ae 100755 --- a/Automation/Modules/Locale/locale.sh +++ b/Automation/Modules/Locale/locale.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# locale.sh -- This module standardizes localization inside the +# repository. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function locale { diff --git a/Automation/Modules/Locale/locale_getOptions.sh b/Automation/Modules/Locale/locale_getOptions.sh index 5c4625d..0648bf2 100755 --- a/Automation/Modules/Locale/locale_getOptions.sh +++ b/Automation/Modules/Locale/locale_getOptions.sh @@ -1,4 +1,29 @@ #!/bin/bash +###################################################################### +# +# locale_getOptions.sh -- Initialize the command-line options used +# by locale module. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Project +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### function locale_getOptions { @@ -49,15 +74,6 @@ function locale_getOptions { ;; -- ) - # Remove the `--' argument from the list of arguments - # in order for processing non-option arguments - # correctly. At this point all option arguments have - # been processed already but the `--' argument still - # remains to mark ending of option arguments and - # beginning of non-option arguments. The `--' argument - # needs to be removed here in order to avoid - # centos-art.sh script to process it as a path inside - # the repository, which obviously is not. shift 1 break ;;