NAME
Jenkins::i18n::ProcOpts - process files definitions based on CLI options
SYNOPSIS
use Jenkins::i18n::ProcOpts;
my $proc = Jenkins::i18n::ProcOpts->new({
source_dir => $source,
target_dir => $target,
use_counter => 1,
is_remove => 1,
is_add => 1,
is_debug => 0,
lang => 'pt_BR',
search => 'foobar'
});
DESCRIPTION
This module define how the translation files should be processed based on the collected CLI options.
EXPORT
None by default.
METHODS
new
Creates a new instance.
Expects a hash reference as parameter, with the following keys:
source_dir
: a string representing the path where the files should be reviewed.target_dir
: a string representing the path where the processed files should be written to.use_counter
: A boolean (in Perl terms) if a counter is to be used.is_remove
: A boolean (in Perl terms) if deprecated files should be removed.is_add
: a boolean (in Perl terms) if new files should be added.is_debug
: a boolean (in Perl terms) if CLI is running in debug mode.lang
: a string identifying the chosen language for processing.search
: optional, an string of a regular expression to match the content of the translated properties, with you want to use that. Otherwise, just provideundef
as a value.
is_to_search
Returns true (1) or false (0) if there is a defined term to search on the translated properties values.
search_term
Returns the compiled regular expression that will be used to match terms in the translated properties values.
get_language
Returns a string identifying the chosen language for processing.
get_source_dir
Returns string of the path where the translation files should be looked for.
get_target_dir
Returns a string of the path where the reviewed translation files should be written to.
inc
Increments the processed files counter.
use_counter
Returns true (1) or false (0) if the processed counter is in use.
get_counter
Returns an integer representing the number of translation files already processed.
is_remove
Returns true (1) or false (0) if the outdated translation files should be removed.
is_add
Returns true (1) or false (0) if the translation files should be added.
is_debug
Returns true (1) or false (0) if the CLI is running in debug mode.
define_files
Based on complete path to a translation file as input, defines the resulting expected translation files and their locations, even if they don't yet exist.
Expects as parameter the complete path to a translation file (Jelly or Java Properties).
Returns an array with the following elements:
The path to the current language file location.
The path to the English Properties file location.
The path to the corresponding Jelly file.
All three items are formed based on convention, that doesn't mean that any of them actually exists in the file system.
AUTHOR
Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2022 of Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org>
This file is part of Jenkins Translation Tool project.
Jenkins Translation Tool 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 3 of the License, or (at your option) any later version.
Jenkins Translation Tool 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 Jenkins Translation Tool. If not, see (http://www.gnu.org/licenses/).
The original translation-tool.pl
script was licensed through the MIT License, copyright (c) 2004-, Kohsuke Kawaguchi, Sun Microsystems, Inc., and a number of other of contributors. Translations files generated by the Jenkins Translation Tool CLI are distributed with the same MIT License.