#!env perl
binmode
STDOUT,
':encoding(UTF-8)'
;
binmode
STDERR,
':encoding(UTF-8)'
;
my
(
$help
,
$pootleBaseurl
,
$apiEndpoint
,
$credentials
,
$cacheFile
);
my
$verbose
= 0;
GetOptions(
'h|help'
=> \
$help
,
'v|verbose:i'
=> \
$verbose
,
'p|pootle-url:s'
=> \
$pootleBaseurl
,
'a|api-endpoint:s'
=> \
$apiEndpoint
,
'c|credentials:s'
=> \
$credentials
,
'cacheFile:s'
=> \
$cacheFile
,
);
my
$usage
=
<<USAGE;
Exports/Imports .po-files from/to version control to/from Koha's translation system
It is advised to test first with the "dry-run"-flag and "test"-flag.
-h --help This friendly help!
-v --verbose String, Log::Log4perl verbosity levels, ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF
-a --api-endpoint String, which Pootle-Client endpoint to invoke?
Supports only GET-requests.
-c --credentials Login credentials to the Pootle-Client. In format username:password,
eg. master:blaster
or
relative or absolute path to a UTF-8 encoded file containing the credentials.
Credentials are found from the file using this regexp /^(.+):(.+)$/
It is not recommended to give credentials as commandline parameters directly.
--cacheFile String, path to the cache file. If doesn't exists, cache file is created.
EXAMPLE
USAGE
if
(
$help
) {
print
$usage
;
exit
0;
}
$ENV
{POOTLE_CLIENT_VERBOSITY} =
$verbose
;
my
$pa
= Pootle::Client->new({
baseUrl
=>
$pootleBaseurl
,
credentials
=>
$credentials
,
cacheFile
=>
$cacheFile
});
my
(
$response
,
$payloadHash
) =
$pa
->a->request(
'get'
,
$apiEndpoint
, {});
say
$response
->content();