NAME
App::Actions::I18N::en - the English message catalogue of App::Actions
SYNOPSIS
You do not normally use this module directly. Choose the language through App::Actions::I18N:
use App::Actions::I18N;
my $i18n = App::Actions::I18N->new(language => 'en');
binmode STDOUT, ':encoding(UTF-8)';
print $i18n->message('workflow.empty', { file => 'ci.yml' }), "\n";
# Workflow 'ci.yml' is empty
Or for a whole run of the command:
ACTION_RUN_LANG=en action-run run .github/workflows/ci.yml
Read the catalogue itself, for example to check a translation:
use App::Actions::I18N::en;
my $entries = App::Actions::I18N::en->messages;
print scalar(keys %{$entries}), " messages\n";
DESCRIPTION
This module holds the English texts of App::Actions' messages.
Data only: App::Actions::I18N loads it and renders its entries. Keys, placeholders and the plural and gender forms are described there.
METHODS
messages
Returns a hash reference of message key to entry.
EXAMPLE
my $entries = App::Actions::I18N::en->messages;
API SPECIFICATION
INPUT
{}
OUTPUT
{ type => q{hashref} }
MESSAGES
None.
COMMON PITFALLS
Do not change the returned hash to translate. "messages" returns a copy, so changes to it are lost. Use "add_messages" in App::Actions::I18N.
Keep the placeholders. A translation must use the same placeholder names as the English text, for example
%(file)s. The test t/i18n.t checks this.Plurals follow the English rule. 1 for one thing, anything else for many:
1 image,2 images,0 images.LANGdoes not choose this language. UseACTION_RUN_LANG=enor thelanguageargument.
ENCODING
The source file is UTF-8 and uses use utf8, so every text is a Perl character string. The texts are plain ASCII today, but may contain any Unicode character. Encode the text when you print it, for example with binmode STDOUT, ':encoding(UTF-8)', or Perl prints a "Wide character" warning.
AUTHOR
Nigel Horne, njh@nigelhorne.com
FORMAL SPECIFICATION
This section describes each routine in the Z notation, a precise mathematical language for describing programs. You do not need to read it to use the module: everything here is also said in plain words in the sections above. It is for readers who want to check exactly what a routine promises.
How to read it: a box names a routine. The lines above the middle rule declare the values it works with. A name ending in ? is an input, and a name ending in ! is an output. ΞState means the routine changes nothing, and ΔState means it can change the state. The lines below the rule are the conditions that are always true when the routine returns.
KEY == { k : seq CHAR | k matches [a-z][a-z0-9_]*(\.[a-z0-9_]+)+ }
ENTRY ::= text⟨⟨seq CHAR⟩⟩
| plural⟨⟨{one, other} ⇸ seq CHAR⟩⟩
| gender⟨⟨{female, male, other} ⇸ ENTRY⟩⟩
MESSAGES : KEY ⇸ ENTRY the fixed catalogue in this file
messages
┌─ Messages ────────────────────────────────────────
│ r! : KEY ⇸ ENTRY
├───────────────────────────────────────────────────
│ r! = MESSAGES
│ r! is a new hash each call: changing it leaves MESSAGES unchanged
└───────────────────────────────────────────────────
STATE DIAGRAM
The catalogue never changes. This is how one of its texts is used:
App::Actions::I18N->new(language => 'en')
(or ACTION_RUN_LANG=en, or a country that speaks English)
|
v
+---------------------+ message($key, \%args)
| TRANSLATOR (en) |------------------------+
+---------------------+ |
v
+-------------------------------------+
| $key in this catalogue? |
+-------------------------------------+
| yes | no
v v
+----------------+ +----------------------+
| entry from | | English entry |
| this module | | (App::Actions::I18N::|
+----------------+ | en); none: the key |
| +----------------------+
+-----------+-----------+
v
gender form, then plural form (English rule),
then the %(name)s placeholders filled in
|
v
the finished text
LICENSE AND COPYRIGHT
Copyright 2026 Nigel Horne.
This program is released under the GNU General Public License, version 2. See the LICENSE file that comes with this distribution. If you use it, please let me know.