diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index f1e4cb675..646dc2282 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -11,6 +11,7 @@ require_once __DIR__."/configs/constants.php"; require_once 'Preference.php'; require_once 'Locale.php'; require_once "DateHelper.php"; +require_once "LocaleHelper.php"; require_once "OsPath.php"; require_once "Database.php"; require_once "Timezone.php"; diff --git a/airtime_mvc/application/controllers/LocaleController.php b/airtime_mvc/application/controllers/LocaleController.php index 612598732..b40c5e748 100644 --- a/airtime_mvc/application/controllers/LocaleController.php +++ b/airtime_mvc/application/controllers/LocaleController.php @@ -2,6 +2,7 @@ class LocaleController extends Zend_Controller_Action { + public function init() { } diff --git a/airtime_mvc/application/models/Locale.php b/airtime_mvc/application/models/Locale.php index 2008591a8..e92d40800 100644 --- a/airtime_mvc/application/models/Locale.php +++ b/airtime_mvc/application/models/Locale.php @@ -2,6 +2,11 @@ class Application_Model_Locale { + private static $domains = [ + 'airtime', + 'pro', + ]; + public static $locales = array( "en_CA" => "English (Canada)", "en_GB" => "English (Britain)", @@ -48,10 +53,14 @@ class Application_Model_Locale Logging::warn("Your system does not have the " . $lang . " locale installed. Run: sudo locale-gen " . $lang); } - $domain = 'airtime'; - bindtextdomain($domain, '../locale'); - textdomain($domain); - bind_textdomain_codeset($domain, $codeset); + // We need to run bindtextdomain and bind_textdomain_codeset for each domain we're using. + foreach (self::$domains as $domain) { + bindtextdomain($domain, '../locale'); + bind_textdomain_codeset($domain, $codeset); + } + + textdomain('airtime'); } + } diff --git a/airtime_mvc/application/views/scripts/billing/invoices.phtml b/airtime_mvc/application/views/scripts/billing/invoices.phtml index 9f2f65ee3..2e6f3ad79 100644 --- a/airtime_mvc/application/views/scripts/billing/invoices.phtml +++ b/airtime_mvc/application/views/scripts/billing/invoices.phtml @@ -4,11 +4,11 @@ $topTextClass = ""; if (array_key_exists("planupdated", $_GET)) { - $topText = _("Thank you! Your plan has been updated and you will be invoiced during your next billing cycle."); + $topText = _pro("Thank you! Your plan has been updated and you will be invoiced during your next billing cycle."); $topTextClass = "status-good"; } else { - $topText = _("Tip: To pay an invoice, click \"View Invoice\"
and look for the \"Checkout\" button."); + $topText = _pro("Tip: To pay an invoice, click \"View Invoice\"
and look for the \"Checkout\" button."); } ?> diff --git a/dev_tools/update_po_files.sh b/dev_tools/update_po_files.sh index a921fd660..bcc3b786e 100755 --- a/dev_tools/update_po_files.sh +++ b/dev_tools/update_po_files.sh @@ -5,10 +5,15 @@ cd .. #generate a new .po file #this will generate a file called messages.po find . -iname "*.phtml" -o -name "*.php" | xargs xgettext -L php --from-code=UTF-8 +find . -iname "*.phtml" -o -name "*.php" | xargs xgettext -L php --from-code=UTF-8 -k --keyword=_pro:1 -d pro --force-po #merge the new messages from messages.po into each existing .po file #this will generate new .po files -find ./airtime_mvc/locale/ -name "*.po" -exec msgmerge -N -U --no-wrap "{}" messages.po \; +find ./airtime_mvc/locale/ -name "airtime.po" -exec msgmerge -N -U --no-wrap "{}" messages.po \; +find ./airtime_mvc/locale/ -name "pro.po" -exec msgmerge -N -U --no-wrap "{}" pro.po \; #delete the old .po files find ./airtime_mvc/locale/ -name "*.po~" -delete + +#delete the temporary po files we create in the root directory +rm ./*.po