NAME
Jenkins::i18n - functions for the jtt CLI
SYNOPSIS
use Jenkins::i18n qw(remove_unused);
DESCRIPTION
jtt is a CLI program used to help translating the Jenkins properties file.
This module implements some of the functions used by the CLI.
EXPORT
None by default.
FUNCTIONS
remove_unused
Remove unused keys from a properties file.
Each translation in every language depends on the original properties files that are written in English.
This function gets a set of keys and compare with those that are stored in the translation file: anything that exists outside the original set in English is considered deprecated and so removed.
Expects as positional parameters:
file: the complete path to the translation file to be checked.
keys: a Set::Tiny instance of the keys from the original English properties file.
license: a scalar reference with a license to include the header of the translated properties file.
backup: a boolean (0 or 1) if a backup file should be created in the same path of the file parameter. Optional.
Returns the number of keys removed (as an integer).
find_files
Find all files Jelly and Java Properties files that could be translated from English, i.e., files that do not have a ISO 639-1 standard language based code as a filename prefix (before the file extension).
Expects as parameter a complete path to a directory that might contain such files.
Returns an sorted array reference with the complete path to those files.
find_langs
Finds all ISO 639-1 standard language based codes available in the Jenkins repository based on the filenames prefix (before the file extension) of the translated files.
This is basically the opposite of find_files does.
It expect as parameters the complete path to a directory to search for the files.
Returns a instance of the Set::Tiny class containing all the language codes that were identified.
Find all files Jelly and Java Properties files that could be translated from English, i.e., files that do not have a ISO 639-1 standard language based code as a filename prefix (before the file extension).
print_license
Print a license text to new files.
Expects as parameters:
the complete path to the file
an array reference with the license text.
load_properties
Loads the content of a Java Properties file into a hash.
Expects as position parameters:
The complete path to a Java Properties file.
True (1) or false (0) if a warn should be printed to
STDERRin case the file is missing.
Returns an hash reference with the file content. If the file doesn't exist, returns an empty hash reference.
load_jelly
Fill a hash with key/1 pairs from a .jelly file.
Expects as parameter the path to a Jelly file.
Returns a hash reference.
SEE ALSO
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.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 187:
=back without =over