Skip to content

Commit

Permalink
multilang
Browse files Browse the repository at this point in the history
  • Loading branch information
ptibogxiv committed Nov 3, 2024
1 parent 711e5e6 commit a9410f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
12 changes: 2 additions & 10 deletions functions/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function doliRelatedProducts($fk_parent_line, $refresh = false) {

function doliprice($object = null, $mode = "ttc", $currency = null) {
global $current_user;

if ( is_object($object) ) {
$total='multicurrency_total_'.$mode;
if ( isset($object->$mode) ) {
Expand All @@ -76,16 +77,7 @@ function doliprice($object = null, $mode = "ttc", $currency = null) {
if ( is_null($currency) ) {
$currency = strtoupper(doliconst("MAIN_MONNAIE"));
}
if ( function_exists('pll_the_languages') ) {
$locale = pll_current_language('locale');
} else {
if ( $current_user->locale == null ) {
$locale = get_locale();
} else {
$locale = $current_user->locale;
}
}
$fmt = numfmt_create( $locale, NumberFormatter::CURRENCY );
$fmt = numfmt_create( doliUserLang($current_user, 'locale'), NumberFormatter::CURRENCY );
return numfmt_format_currency($fmt, $montant, $currency);//.$decimal
}
}
Expand Down
4 changes: 2 additions & 2 deletions functions/tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,9 @@ function doliopeninghours($constante){
}
}

function doliUserLang($user, $short = false) {
function doliUserLang($user, $type = 'locale', $short = false) {
if ( function_exists('pll_current_language') ) {
$lang = pll_current_language('locale');
$lang = pll_current_language($type);
} elseif ( function_exists('wpml_object_id') ) {
return get_locale(); // to do
} elseif (isset($user->locale) && !empty($user->locale)) {
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ We would like to thank this contributors and plugins:
* better shop
* better transient
* better captcha
* better multilang with polylang & wpml
* fix php bugs & error

= 8.9.x =
Expand Down

0 comments on commit a9410f0

Please sign in to comment.