Created
April 26, 2018 03:56
-
-
Save gusrub/bbbb87c3469108353a082f8502f865ec to your computer and use it in GitHub Desktop.
I18n helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Helpers\I18n { | |
// I18N support information here | |
$language = 'es_MX.utf8'; | |
putenv("LC_ALL=$language"); | |
putenv("LC_LANG=$language"); | |
setlocale(LC_ALL, $language); | |
// // Set the text domain as 'messages' | |
$domain = 'messages'; | |
bindtextdomain($domain, "Locale"); | |
textdomain($domain); | |
function translate($str, ...$args) | |
{ | |
return sprintf(_($str), ...$args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment