Skip to content

Instantly share code, notes, and snippets.

@SitesByYogi
Last active January 13, 2023 14:47
Show Gist options
  • Save SitesByYogi/b6e9f21d4d80158422872b52c23e3637 to your computer and use it in GitHub Desktop.
Save SitesByYogi/b6e9f21d4d80158422872b52c23e3637 to your computer and use it in GitHub Desktop.
ADD support for EGP (Egyptian currency) to Sprout Invoices
<?php
// do not include above code
function si_filter_localeconv( $localeconv = array(), $doc_id = 0, $locale = '' ) {
switch ( $locale ) {
case 'en_GB':
$localeconv = egp_local_array();
break;
case 'en_US':
$localeconv = us_local_array();
break;
}
return $localeconv;
}
add_filter( 'si_get_localeconv', 'si_filter_localeconv', 10, 3 );
function us_local_array() {
return array(
'decimal_point' => '.',
'thousands_sep' => '',
'int_curr_symbol' => 'USD',
'currency_symbol' => '$',
'mon_decimal_point' => '.',
'mon_thousands_sep' => ',',
'positive_sign' => '',
'negative_sign' => '-',
'int_frac_digits' => 2,
'frac_digits' => 2,
'p_cs_precedes' => 1,
'p_sep_by_space' => 0,
'n_cs_precedes' => 1,
'n_sep_by_space' => 0,
'p_sign_posn' => 1,
'n_sign_posn' => 1,
'grouping' => array(),
'mon_grouping' => array( 3, 3 ),
);
}
function egp_local_array() {
return array(
'decimal_point' => ',',
'thousands_sep' => '.',
'int_curr_symbol' => 'E£',
'currency_symbol' => 'E£',
'mon_decimal_point' => ',',
'mon_thousands_sep' => '.',
'positive_sign' => '',
'negative_sign' => '-',
'int_frac_digits' => 2,
'frac_digits' => 2,
'p_cs_precedes' => 1,
'p_sep_by_space' => 0,
'n_cs_precedes' => 1,
'n_sep_by_space' => 0,
'p_sign_posn' => 1,
'n_sign_posn' => 1,
'grouping' => array(),
'mon_grouping' => array( 3, 3 ),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment