Actions Status

NAME

App::Greple::xlate - translation support module for greple

SYNOPSIS

greple -Mxlate::deepl --xlate pattern target-file

DESCRIPTION

Greple xlate module find text blocks and replace them by the translated text. Currently only DeepL service is supported by the xlate::deepl module.

If you want to translate normal text block in pod style document, use greple command with xlate::deepl and perl module like this:

greple -Mxlate::deepl -Mperl --pod --re '^(\w.*\n)+' --all foo.pm

Pattern ^(\w.*\n)+ means consecutive lines starting with alpha-numeric letter. This command show the area to be translated. Option --all is used to produce entire text.

<p><img width="750" src="https://raw.githubusercontent.com/kaz-utashiro/App-Greple-xlate/main/images/select-area.png"></p>

Then add --xlate option to translate the selected area. It will find and replace them by the deepl command output.

By default, original and translated text is printed in the conflict marker format compatible with git(1). Using ifdef format, you can get desired part by unifdef(1) command easily. Format can be specified by --deepl-format option.

<p><img width="750" src="https://raw.githubusercontent.com/kaz-utashiro/App-Greple-xlate/main/images/format-conflict.png"></p>

If you want to translate entire text, use --match-entire option. This is a short-cut to specify the pattern matches entire text (?s).*.

OPTIONS

CACHE OPTIONS

xlate module can store cached text of translation for each file and read it before execution to eliminate the overhead of asking to server. With the default cache strategy auto, it maintains cache data only when the cache file exists for target file. If the corresponding cache file does not exist, it does not create it.

ENVIRONMENT

SEE ALSO

AUTHOR

Kazumasa Utashiro

LICENSE

Copyright ©︎ 2023 Kazumasa Utashiro.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.