The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Jenkins::i18n::Properties - a subclass of Config::Properties

SYNOPSIS

  use Jenkins::i18n::Properties;

  # reading...
  open my $fh, '<', 'my_config.props'
    or die "unable to open configuration file";
  my $properties = Config::Properties->new();
  $properties->load($fh);
  $value = $properties->getProperty($key);

  # saving...
  open my $fh, '>', 'my_config.props'
    or die "unable to open configuration file for writing";
  $properties->setProperty($key, $value);
  $properties->format('%s => %s');
  $properties->store($fh, $header );

DESCRIPTION

Jenkins::i18n::Properties is a subclass of Config::Properties and works pretty much the same, except regarding the save method, which is overrided.

EXPORT

None by default.

METHODS

save

This is an overrided method from the parent class.

It expects to receive the following positional parameters:

  1. A opened file handle created with open.

  2. An array reference with the license content to include in the properties file.

Both are required.

This method, differently from the original of the parent class, does not include a timestamp with localtime.

This method does not closes the given filehand at the end of the writting.

unescape

Remove escape characters from a string.

Expects a single string parameter, changing it in place.

process_line

This is a method overrided from the superclass.

Process a single line retrieved from the Java properties file, saving the key and value internally.

Returns 1 if everything goes fine.

This method was overrided to allow the key value to retain it's escape characters, as required by Jenkins translation files.

Additionally, this method will not attempt to fix UTF-8 BOM from very old perl interpreters (version 5.6.0).

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.