NAME

App::Actions::I18N::fr - the French 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 => 'fr');
binmode STDOUT, ':encoding(UTF-8)';
print $i18n->message('workflow.empty', { file => 'ci.yml' }), "\n";
# Le workflow 'ci.yml' est vide

Or for a whole run of the command:

ACTION_RUN_LANG=fr action-run run .github/workflows/ci.yml

Read the catalogue itself, for example to check a translation:

use App::Actions::I18N::fr;

my $entries = App::Actions::I18N::fr->messages;
print scalar(keys %{$entries}), " messages\n";

DESCRIPTION

This module holds the French texts of App::Actions' messages. A key that is missing here is shown in English instead.

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::fr->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 French rule. 0 and 1 use the one form (0 image, 1 image), 2 and more the other form (2 images).

  • LANG does not choose this language. Use ACTION_RUN_LANG=fr or the language argument.

ENCODING

The source file is UTF-8 and uses use utf8, so every text is a Perl character string. The texts contain non-ASCII characters (accented letters such as é), and 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 => 'fr')
 (or ACTION_RUN_LANG=fr, or a country that speaks French)
        |
        v
+---------------------+  message($key, \%args)
| TRANSLATOR (fr)   |------------------------+
+---------------------+                        |
                                               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 (French 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.