Created
August 30, 2018 15:23
-
-
Save AminulBD/7ae9ac9f5043db986433f28ba69f6cea to your computer and use it in GitHub Desktop.
Bangla WordPress Number
This file contains hidden or 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 | |
/* | |
Plugin Name: Bangla Number For WordPress | |
Plugin URI: https://aminul.net/ | |
Description: Translate all number to bangla. | |
Version: 1.0.0 | |
Author: Aminul Islam | |
Author URI: https://aminul.net/ | |
License: GPL2 | |
License URI: https://www.gnu.org/licenses/gpl-2.0.html | |
Text Domain: ambn | |
Domain Path: /languages | |
*/ | |
/** | |
* @link https://tareq.co/2010/09/translate-wordpress-date-time-comment-number-to-bangla-digit/ | |
*/ | |
function ambn_make_bangla_number( $str ) { | |
$engNumber = array(1,2,3,4,5,6,7,8,9,0); | |
$bangNumber = array('১','২','৩','৪','৫','৬','৭','৮','৯','০'); | |
$converted = str_replace($engNumber, $bangNumber, $str); | |
return $converted; | |
} | |
add_filter( 'human_time_diff', 'ambn_make_bangla_number' ); | |
add_filter( 'get_comments_number', 'ambn_make_bangla_number' ); | |
add_filter( 'date_i18n', 'ambn_make_bangla_number' ); | |
add_filter( 'number_format_i18n', 'ambn_make_bangla_number'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment