pustakakoran

Cara Setting File Manual Tanggal Indonesia di Wordpress

Oct 15th, 2019
114
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /home/natuna/public_html/wp-includes/class-wp-locale.php
  2.  
  3. --------------INI SUDAH DIGANTI KE INDONESIA TIME -------
  4.  
  5. <?php
  6. /**
  7. * Locale API: WP_Locale class
  8. *
  9. * @package WordPress
  10. * @subpackage i18n
  11. * @since 4.6.0
  12. */
  13.  
  14. /**
  15. * Core class used to store translated data for a locale.
  16. *
  17. * @since 2.1.0
  18. * @since 4.6.0 Moved to its own file from wp-includes/locale.php.
  19. */
  20. class WP_Locale {
  21. /**
  22. * Stores the translated strings for the full weekday names.
  23. *
  24. * @since 2.1.0
  25. * @var array
  26. */
  27. public $weekday;
  28.  
  29. /**
  30. * Stores the translated strings for the one character weekday names.
  31. *
  32. * There is a hack to make sure that Selasa and Kamis, as well
  33. * as Minggu and Sabtu, don't conflict. See init() method for more.
  34. *
  35. * @see WP_Locale::init() for how to handle the hack.
  36. *
  37. * @since 2.1.0
  38. * @var array
  39. */
  40. public $weekday_initial;
  41.  
  42. /**
  43. * Stores the translated strings for the abbreviated weekday names.
  44. *
  45. * @since 2.1.0
  46. * @var array
  47. */
  48. public $weekday_abbrev;
  49.  
  50. /**
  51. * Stores the translated strings for the full month names.
  52. *
  53. * @since 2.1.0
  54. * @var array
  55. */
  56. public $month;
  57.  
  58. /**
  59. * Stores the translated strings for the month names in genitive case, if the locale specifies.
  60. *
  61. * @since 4.4.0
  62. * @var array
  63. */
  64. public $month_genitive;
  65.  
  66. /**
  67. * Stores the translated strings for the abbreviated month names.
  68. *
  69. * @since 2.1.0
  70. * @var array
  71. */
  72. public $month_abbrev;
  73.  
  74. /**
  75. * Stores the translated strings for 'am' and 'pm'.
  76. *
  77. * Also the capitalized versions.
  78. *
  79. * @since 2.1.0
  80. * @var array
  81. */
  82. public $meridiem;
  83.  
  84. /**
  85. * The text direction of the locale language.
  86. *
  87. * Default is left to right 'ltr'.
  88. *
  89. * @since 2.1.0
  90. * @var string
  91. */
  92. public $text_direction = 'ltr';
  93.  
  94. /**
  95. * The thousands separator and decimal point values used for localizing numbers.
  96. *
  97. * @since 2.3.0
  98. * @var array
  99. */
  100. public $number_format;
  101.  
  102. /**
  103. * Constructor which calls helper methods to set up object variables.
  104. *
  105. * @since 2.1.0
  106. */
  107. public function __construct() {
  108. $this->init();
  109. $this->register_globals();
  110. }
  111.  
  112. /**
  113. * Sets up the translated strings and object properties.
  114. *
  115. * The method creates the translatable strings for various
  116. * calendar elements. Which allows for specifying locale
  117. * specific calendar names and text direction.
  118. *
  119. * @since 2.1.0
  120. *
  121. * @global string $text_direction
  122. * @global string $wp_version The WordPress version string.
  123. */
  124. public function init() {
  125. // The weekdays.
  126. $this->weekday[0] = /* translators: Weekday. */ __( 'Minggu' );
  127. $this->weekday[1] = /* translators: Weekday. */ __( 'Senin' );
  128. $this->weekday[2] = /* translators: Weekday. */ __( 'Selasa' );
  129. $this->weekday[3] = /* translators: Weekday. */ __( 'Rabu' );
  130. $this->weekday[4] = /* translators: Weekday. */ __( 'Kamis' );
  131. $this->weekday[5] = /* translators: Weekday. */ __( 'Jumat' );
  132. $this->weekday[6] = /* translators: Weekday. */ __( 'Sabtu' );
  133.  
  134. // The first letter of each day.
  135. $this->weekday_initial[ __( 'Minggu' ) ] = /* translators: One-letter abbreviation of the weekday. */ _x( 'M', 'Minggu initial' );
  136. $this->weekday_initial[ __( 'Senin' ) ] = /* translators: One-letter abbreviation of the weekday. */ _x( 'S', 'Senin initial' );
  137. $this->weekday_initial[ __( 'Selasa' ) ] = /* translators: One-letter abbreviation of the weekday. */ _x( 'S', 'Selasa initial' );
  138. $this->weekday_initial[ __( 'Rabu' ) ] = /* translators: One-letter abbreviation of the weekday. */ _x( 'R', 'Rabu initial' );
  139. $this->weekday_initial[ __( 'Kamis' ) ] = /* translators: One-letter abbreviation of the weekday. */ _x( 'K', 'Kamis initial' );
  140. $this->weekday_initial[ __( 'Jumat' ) ] = /* translators: One-letter abbreviation of the weekday. */ _x( 'J', 'Jumat initial' );
  141. $this->weekday_initial[ __( 'Sabtu' ) ] = /* translators: One-letter abbreviation of the weekday. */ _x( 'S', 'Sabtu initial' );
  142.  
  143. // Abbreviations for each day.
  144. $this->weekday_abbrev[ __( 'Minggu' ) ] = /* translators: Three-letter abbreviation of the weekday. */ __( 'Min' );
  145. $this->weekday_abbrev[ __( 'Senin' ) ] = /* translators: Ttree-letter abbreviation of the weekday. */ __( 'Sen' );
  146. $this->weekday_abbrev[ __( 'Selasa' ) ] = /* translators: Three-letter abbreviation of the weekday. */ __( 'Sel' );
  147. $this->weekday_abbrev[ __( 'Rabu' ) ] = /* translators: Three-letter abbreviation of the weekday. */ __( 'Rab' );
  148. $this->weekday_abbrev[ __( 'Kamis' ) ] = /* translators: Three-letter abbreviation of the weekday. */ __( 'Kam' );
  149. $this->weekday_abbrev[ __( 'Jumat' ) ] = /* translators: Three-letter abbreviation of the weekday. */ __( 'Jum' );
  150. $this->weekday_abbrev[ __( 'Sabtu' ) ] = /* translators: Three-letter abbreviation of the weekday. */ __( 'Sab' );
  151.  
  152. // The months.
  153. $this->month['01'] = /* translators: Month name. */ __( 'Januari' );
  154. $this->month['02'] = /* translators: Month name. */ __( 'Februari' );
  155. $this->month['03'] = /* translators: Month name. */ __( 'Maret' );
  156. $this->month['04'] = /* translators: Month name. */ __( 'April' );
  157. $this->month['05'] = /* translators: Month name. */ __( 'Mei' );
  158. $this->month['06'] = /* translators: Month name. */ __( 'Juni' );
  159. $this->month['07'] = /* translators: Month name. */ __( 'Juli' );
  160. $this->month['08'] = /* translators: Month name. */ __( 'Agustus' );
  161. $this->month['09'] = /* translators: Month name. */ __( 'September' );
  162. $this->month['10'] = /* translators: Month name. */ __( 'Oktober' );
  163. $this->month['11'] = /* translators: Month name. */ __( 'November' );
  164. $this->month['12'] = /* translators: Month name. */ __( 'Desember' );
  165.  
  166. // The months, genitive.
  167. $this->month_genitive['01'] = /* translators: Month name, genitive. */ _x( 'Januari', 'genitive' );
  168. $this->month_genitive['02'] = /* translators: Month name, genitive. */ _x( 'Februari', 'genitive' );
  169. $this->month_genitive['03'] = /* translators: Month name, genitive. */ _x( 'Maret', 'genitive' );
  170. $this->month_genitive['04'] = /* translators: Month name, genitive. */ _x( 'April', 'genitive' );
  171. $this->month_genitive['05'] = /* translators: Month name, genitive. */ _x( 'Mei', 'genitive' );
  172. $this->month_genitive['06'] = /* translators: Month name, genitive. */ _x( 'Juni', 'genitive' );
  173. $this->month_genitive['07'] = /* translators: Month name, genitive. */ _x( 'Juli', 'genitive' );
  174. $this->month_genitive['08'] = /* translators: Month name, genitive. */ _x( 'Agustus', 'genitive' );
  175. $this->month_genitive['09'] = /* translators: Month name, genitive. */ _x( 'September', 'genitive' );
  176. $this->month_genitive['10'] = /* translators: Month name, genitive. */ _x( 'Oktober', 'genitive' );
  177. $this->month_genitive['11'] = /* translators: Month name, genitive. */ _x( 'November', 'genitive' );
  178. $this->month_genitive['12'] = /* translators: Month name, genitive. */ _x( 'Desember', 'genitive' );
  179.  
  180. // Abbreviations for each month.
  181. $this->month_abbrev[ __( 'Januari' ) ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Jan', 'January abbreviation' );
  182. $this->month_abbrev[ __( 'Februari' ) ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Feb', 'February abbreviation' );
  183. $this->month_abbrev[ __( 'Maret' ) ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Mar', 'March abbreviation' );
  184. $this->month_abbrev[ __( 'April' ) ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Apr', 'April abbreviation' );
  185. $this->month_abbrev[ __( 'Mei' ) ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Mei', 'May abbreviation' );
  186. $this->month_abbrev[ __( 'Juni' ) ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Jun', 'June abbreviation' );
  187. $this->month_abbrev[ __( 'Juli' ) ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Jul', 'July abbreviation' );
  188. $this->month_abbrev[ __( 'Agustus' ) ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Ags', 'August abbreviation' );
  189. $this->month_abbrev[ __( 'September' ) ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Sep', 'September abbreviation' );
  190. $this->month_abbrev[ __( 'Oktober' ) ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Okt', 'October abbreviation' );
  191. $this->month_abbrev[ __( 'November' ) ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Nov', 'November abbreviation' );
  192. $this->month_abbrev[ __( 'Desember' ) ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Des', 'December abbreviation' );
  193.  
  194. // The meridiems.
  195. $this->meridiem['am'] = __( 'am' );
  196. $this->meridiem['pm'] = __( 'pm' );
  197. $this->meridiem['AM'] = __( 'AM' );
  198. $this->meridiem['PM'] = __( 'PM' );
  199.  
  200. // Numbers formatting.
  201. // See https://www.php.net/number_format
  202.  
  203. /* translators: $thousands_sep argument for https://www.php.net/number_format, default is ',' */
  204. $thousands_sep = __( 'number_format_thousands_sep' );
  205.  
  206. // Replace space with a non-breaking space to avoid wrapping.
  207. $thousands_sep = str_replace( ' ', '&nbsp;', $thousands_sep );
  208.  
  209. $this->number_format['thousands_sep'] = ( 'number_format_thousands_sep' === $thousands_sep ) ? ',' : $thousands_sep;
  210.  
  211. /* translators: $dec_point argument for https://www.php.net/number_format, default is '.' */
  212. $decimal_point = __( 'number_format_decimal_point' );
  213.  
  214. $this->number_format['decimal_point'] = ( 'number_format_decimal_point' === $decimal_point ) ? '.' : $decimal_point;
  215.  
  216. // Set text direction.
  217. if ( isset( $GLOBALS['text_direction'] ) ) {
  218. $this->text_direction = $GLOBALS['text_direction'];
  219.  
  220. /* translators: 'rtl' or 'ltr'. This sets the text direction for WordPress. */
  221. } elseif ( 'rtl' == _x( 'ltr', 'text direction' ) ) {
  222. $this->text_direction = 'rtl';
  223. }
  224. }
  225.  
  226. /**
  227. * Retrieve the full translated weekday word.
  228. *
  229. * Week starts on translated Minggu and can be fetched
  230. * by using 0 (zero). So the week starts with 0 (zero)
  231. * and ends on Sabtu with is fetched by using 6 (six).
  232. *
  233. * @since 2.1.0
  234. *
  235. * @param int $weekday_number 0 for Minggu through 6 Sabtu.
  236. * @return string Full translated weekday.
  237. */
  238. public function get_weekday( $weekday_number ) {
  239. return $this->weekday[ $weekday_number ];
  240. }
  241.  
  242. /**
  243. * Retrieve the translated weekday initial.
  244. *
  245. * The weekday initial is retrieved by the translated
  246. * full weekday word. When translating the weekday initial
  247. * pay attention to make sure that the starting letter does
  248. * not conflict.
  249. *
  250. * @since 2.1.0
  251. *
  252. * @param string $weekday_name Full translated weekday word.
  253. * @return string Translated weekday initial.
  254. */
  255. public function get_weekday_initial( $weekday_name ) {
  256. return $this->weekday_initial[ $weekday_name ];
  257. }
  258.  
  259. /**
  260. * Retrieve the translated weekday abbreviation.
  261. *
  262. * The weekday abbreviation is retrieved by the translated
  263. * full weekday word.
  264. *
  265. * @since 2.1.0
  266. *
  267. * @param string $weekday_name Full translated weekday word.
  268. * @return string Translated weekday abbreviation.
  269. */
  270. public function get_weekday_abbrev( $weekday_name ) {
  271. return $this->weekday_abbrev[ $weekday_name ];
  272. }
  273.  
  274. /**
  275. * Retrieve the full translated month by month number.
  276. *
  277. * The $month_number parameter has to be a string
  278. * because it must have the '0' in front of any number
  279. * that is less than 10. Starts from '01' and ends at
  280. * '12'.
  281. *
  282. * You can use an integer instead and it will add the
  283. * '0' before the numbers less than 10 for you.
  284. *
  285. * @since 2.1.0
  286. *
  287. * @param string|int $month_number '01' through '12'.
  288. * @return string Translated full month name.
  289. */
  290. public function get_month( $month_number ) {
  291. return $this->month[ zeroise( $month_number, 2 ) ];
  292. }
  293.  
  294. /**
  295. * Retrieve translated version of month abbreviation string.
  296. *
  297. * The $month_name parameter is expected to be the translated or
  298. * translatable version of the month.
  299. *
  300. * @since 2.1.0
  301. *
  302. * @param string $month_name Translated month to get abbreviated version.
  303. * @return string Translated abbreviated month.
  304. */
  305. public function get_month_abbrev( $month_name ) {
  306. return $this->month_abbrev[ $month_name ];
  307. }
  308.  
  309. /**
  310. * Retrieve translated version of meridiem string.
  311. *
  312. * The $meridiem parameter is expected to not be translated.
  313. *
  314. * @since 2.1.0
  315. *
  316. * @param string $meridiem Either 'am', 'pm', 'AM', or 'PM'. Not translated version.
  317. * @return string Translated version
  318. */
  319. public function get_meridiem( $meridiem ) {
  320. return $this->meridiem[ $meridiem ];
  321. }
  322.  
  323. /**
  324. * Global variables are deprecated.
  325. *
  326. * For backward compatibility only.
  327. *
  328. * @deprecated For backward compatibility only.
  329. *
  330. * @global array $weekday
  331. * @global array $weekday_initial
  332. * @global array $weekday_abbrev
  333. * @global array $month
  334. * @global array $month_abbrev
  335. *
  336. * @since 2.1.0
  337. */
  338. public function register_globals() {
  339. $GLOBALS['weekday'] = $this->weekday;
  340. $GLOBALS['weekday_initial'] = $this->weekday_initial;
  341. $GLOBALS['weekday_abbrev'] = $this->weekday_abbrev;
  342. $GLOBALS['month'] = $this->month;
  343. $GLOBALS['month_abbrev'] = $this->month_abbrev;
  344. }
  345.  
  346. /**
  347. * Checks if current locale is RTL.
  348. *
  349. * @since 3.0.0
  350. * @return bool Whether locale is RTL.
  351. */
  352. public function is_rtl() {
  353. return 'rtl' == $this->text_direction;
  354. }
  355.  
  356. /**
  357. * Register date/time format strings for general POT.
  358. *
  359. * Private, unused method to add some date/time formats translated
  360. * on wp-admin/options-general.php to the general POT that would
  361. * otherwise be added to the admin POT.
  362. *
  363. * @since 3.6.0
  364. */
  365. public function _strings_for_pot() {
  366. /* translators: Localized date format, see https://www.php.net/date */
  367. __( 'F j, Y' );
  368. /* translators: Localized time format, see https://www.php.net/date */
  369. __( 'g:i a' );
  370. /* translators: Localized date and time format, see https://www.php.net/date */
  371. __( 'F j, Y g:i a' );
  372. }
  373. }
RAW Paste Data