NAME

Locale::TextDomain::IfEnv - Enable translation only when environment variable flag is true

VERSION

This document describes version 0.002 of Locale::TextDomain::IfEnv (from Perl distribution Locale-TextDomain-IfEnv), released on 2019-12-26.

SYNOPSIS

Use like you would use Locale::TextDomain (but see "Caveats"):

 use Locale::TextDomain::IfEnv 'Some-TextDomain';

 print __ "Hello, world!\n";

DESCRIPTION

When imported, Locale::TextDomain::IfEnv will check the PERL_LOCALE_TEXTDOMAIN_IFENV environment variable. If the environment variable has a true value, the module will load Locale::TextDomain and pass the import arguments to it. If the environment variable is false, the module will install a mock version of __, et al. Thus, all strings will translate to themselves.

This module can be used to avoid the startup (and runtime) cost of translation unless when you want to enable translation.

Caveats

For simplicity, currently the tied hash (%__) and its hashref ($__) are not provided. Contact me if you use and need this.

ENVIRONMENT

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Locale-TextDomain-IfEnv.

SOURCE

Source repository is at https://github.com/perlancar/perl-Locale-TextDomain-IfEnv.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Locale-TextDomain-IfEnv

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

Locale::TextDomain

Locale::TextDomain::UTF8::IfEnv

Bencher::Scenarios::LocaleTextDomainIfEnv

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019 by perlancar@cpan.org.

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