Skip to content

Instantly share code, notes, and snippets.

@gusrub gusrub/i18n.php
Created Apr 26, 2018

Embed
What would you like to do?
I18n helper
<?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
You can’t perform that action at this time.