Hello njfranck. I suppose you meant "fallback_languages" rather than "language_languages"? If so, overwriting it actually (partially) works: the list of default it returns is ('i-default', 'en', 'en-US'), and both "i-default" and "en-US" are successfully removed as fallbacks when you have a Loc::fallback_languages defined.

But beside those fallbacks, Locale::Maketext also uses the panic languages from I18N::LangTags as seen here.

One way to disable that behaviour is to set $Locale::Maketext::USING_LANGUAGE_TAGS = 0;. I can't tell you what else it does though (it's not documented and I don't want to analyze the whole code).

Another way to it is to locally replace I18N::LangTags::panic_languages so that it returns the empty list. It's a little dirtier, but at least it's limited in scope:

package Loc; use parent "Locale::Maketext"; use Locale::Maketext::Lexicon { "en" => [ Gettext => \*main::DATA ] }; sub fallback_languages { }; package main; use Data::Dump qw( pp ); use strict; { # The effect of local will be reversed outside of this block local *I18N::LangTags::panic_languages = sub {}; print ( Loc->get_handle("nl") ? pp(Loc->get_handle("nl")) : "OK: got + undef" ); } # end of local, so limited side effects print "\n"; __DATA__ msgid "greet" msgstr "hello %1"
Notice that I still have Loc::fallback_languages to overwrite one set of defaults beside the panic languages ("en" is defined in both)


In reply to Re: Disable use of fallback language in Locale::Maketext::Lexicon by Eily
in thread Disable use of fallback language in Locale::Maketext::Lexicon by njfranck

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.