Catalyst-Plugin-I18N-PathPrefixGeoIP

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


    You can wrap this method (using eg. the "after" in Moose method
    modifier) so you can store the language code into the stash if you like:

      after set_languages_from_language_prefix => sub {
        my $c = shift;

        $c->stash('language' => $c->language);
      };

  uri_for_in_language
      $c->uri_for_in_language($language_code => @uri_for_args)

    Returns: $uri_object

    The same as "uri_for" in Catalyst but returns the URI with the
    $language_code path prefix (independently of what the current language
    is).

    Internally this method temporarily sets the paths in "$c->req", calls
    "uri_for" in Catalyst then resets the paths. Ineffective, but you
    usually call it very infrequently.

    Note: You should not call this method to generate language-independent
    paths, as it will generate invalid URLs currently (ie. the language
    independent path prefixed with the language prefix).

    Note: This module intentionally does not override "uri_for" in Catalyst
    but provides this method instead: "uri_for" in Catalyst is usually
    called many times per request, and most of the cases you want it to use
    the current language; not overriding it can be a significant performance
    saving. YMMV.

  switch_language
      $c->switch_language($language_code)

    Returns: N/A

    Changes "$c->req->base" to end with $language_code and calls
    "$c->set_languages_from_language_prefix" with $language_code.

    Useful if you want to switch the language later in the request
    processing (eg. from a request parameter, from the session or from the
    user object).

  language_switch_options
      $c->language_switch_options()

    Returns: "{ $language_code => { name => $language_name, uri => $uri },
    ... }"

    Returns a data structure that contains all the necessary data (language
    code, name, URL of the same page) for displaying a language switch
    widget on the page.

    The data structure is a hashref with one key for each valid language
    code (see the "valid_languages" config option) (in all-lowercase format)
    and the value is a hashref that contains the following key-value pairs:

    name
        The localized (translated) name of the language. (The actual msgid
        used in "$c->loc()" is the English name of the language, returned by
        "name" in I18N::LangTags::List.)

    url The URL of the equivalent of the current page in that language (ie.
        the language prefix replaced).

    You can find an example TT2 HTML template for the language switch
    included in the distribution.

  valid_languages
      $c->valid_languages

    Returns: Array of valid language codes

    "valid_languages" returns the language codes you configured in the
    valid_languages configuration.

    Useful if you want to go through all valid languages. For example to
    make a sitemap.

SEE ALSO
    Catalyst::Plugin::I18N::PathPrefix, Catalyst::Plugin::I18N,
    Catalyst::TraitFor::Request::PerLanguageDomains

AUTHOR
    PathPrefix: Norbert Buchmuller, "<norbi at nix.hu"> PathPrefixGeoIP:
    Runar Buvik: "<runarb at gmail.com"> =head1 TODO

    make "uri_for_in_language" work on language-independent URIs
    support locales instead of language codes

BUGS
    Please report any bugs or feature requests to
    "bug-catalyst-plugin-i18n-pathprefix at rt.cpan.org", or through the web
    interface at
    <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Plugin-I18N-Pat
    hPrefixGeoIP>. I will be notified, and then you'll automatically be
    notified of progress on your bug as I make changes.

SUPPORT
    You can find documentation for this module with the perldoc command.

        perldoc Catalyst::Plugin::I18N::PathPrefixGeoIP

    You can also look for information at:

    *   RT: CPAN's request tracker

        <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-Plugin-I18N-PathP
        refixGeoIP>

    *   AnnoCPAN: Annotated CPAN documentation

        <http://annocpan.org/dist/Catalyst-Plugin-I18N-PathPrefixGeoIP>

    *   CPAN Ratings

        <http://cpanratings.perl.org/d/Catalyst-Plugin-I18N-PathPrefixGeoIP>

    *   Search CPAN



( run in 0.860 second using v1.01-cache-2.11-cpan-5735350b133 )