Actions Status

NAME

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

SYNOPSIS

greple -Mxlate -e ENGINE --xlate pattern target-file

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

VERSION

Version 0.26

DESCRIPTION

Greple xlate module find text blocks and replace them by the translated text. Include DeepL (deepl.pm) and ChatGPT (gpt3.pm) module for back-end engine.

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.

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 --xlate-format option.

If you want to translate entire text, use --match-all 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.

COMMAND LINE INTERFACE

You can easily use this module from the command line by using the xlate command included in the repository. See the xlate help information for usage.

EMACS

Load the xlate.el file included in the repository to use xlate command from Emacs editor. xlate-region function translate the given region. Default language is EN-US and you can specify language invoking it with prefix argument.

ENVIRONMENT

INSTALL

CPANMINUS

$ cpanm App::Greple::xlate

TOOLS

You have to install command line tools for DeepL and ChatGPT.

https://github.com/DeepLcom/deepl-python

https://github.com/tecolicom/App-gpty

SEE ALSO

App::Greple::xlate

App::Greple::xlate::deepl

App::Greple::xlate::gpt3

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.