# Pastebin xhBULlDs $ perl6 -e ' class TranslatableStr {my %translations; has Str %.translations; has Str $.default = %!translations.keys == 1 ?? %!translations.keys.head !! "english"; has Str $.name = %!translations{ $!default } // die "no default name"; method Str { try { %!translations{ $*lang } } // %!translations{ $!default } // $!name } method gist { $.Str } submethod TWEAK(|) { %translations{ $!name } = self } method translate(Str() $str) { %translations{ $str } } } TranslatableStr.new: :translations{:english, :portuguese} my $*lang = "portuguese"; say TranslatableStr.translate: "chair" ' cadeira