App-SpreadRevolutionaryDate

 view release on metacpan or  search on metacpan

lib/App/SpreadRevolutionaryDate/MsgMaker.pm  view on Meta::CPAN

#
# This file is part of App-SpreadRevolutionaryDate
#
# This software is Copyright (c) 2019-2026 by Gérald Sédrati.
#
# This is free software, licensed under:
#
#   The GNU General Public License, Version 3, June 2007
#
use 5.014;
use utf8;
package App::SpreadRevolutionaryDate::MsgMaker;
$App::SpreadRevolutionaryDate::MsgMaker::VERSION = '0.54';
# ABSTRACT: Role providing interface for crafting a message to be spread by L<App::SpreadRevolutionaryDate>.

use Moose::Role;
use Locale::Util qw(set_locale);
use Locale::Messages qw(LC_ALL nl_putenv);

use Locale::TextDomain 'App-SpreadRevolutionaryDate';
use namespace::autoclean;

has locale => (
  is => 'ro',
  isa => 'Str',
  required => 1,
  default => 'en',
  trigger => sub {
    # Set locale to $val, see https://metacpan.org/pod/Locale::TextDomain::FAQ#How-do-I-switch-languages-or-force-a-certain-language-independently-from-user-settings-read-from-the-environment?
    my ( $self, $val, $old_val ) = @_;
    if ($val) {
      Locale::Messages->select_package('gettext_pp');
      set_locale(LC_ALL, $val, undef, 'utf-8');
      nl_putenv("LANGUAGE=$val");
      nl_putenv("LANG=$val");
      nl_putenv("OUTPUT_CHARSET=utf-8");
    }
  },
);

has special_birthday_name => (
  is => 'ro',
  isa => 'Str',
  default => '',
);

has special_birthday_day => (
  is => 'ro',
  isa => 'Int',
  default => 0,
);

has special_birthday_month => (
  is => 'ro',
  isa => 'Int',
  default => 0,
);

has special_birthday_url => (
  is => 'ro',
  isa => 'Str',
  default => '',
);

has special_birthday_gemini => (
  is => 'ro',
  isa => 'Str',
  default => '',
);

has special_birthday_prefix => (
  is => 'ro',
  isa => 'Int',
  default => 0,
);

has special_birthday_plural => (
  is => 'ro',
  isa => 'Str',
  default => '',
);



( run in 1.710 second using v1.01-cache-2.11-cpan-0d23b851a93 )