mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Xomw: Add more implementation for extractParam
This commit is contained in:
parent
af2d0c51db
commit
417fd8b990
@ -3010,13 +3010,13 @@ public class XomwDefaultSettings {
|
||||
// * is 'dmy or mdy'.
|
||||
// */
|
||||
// $wgAmericanDates = false;
|
||||
//
|
||||
// /**
|
||||
// * For Hindi and Arabic use local numerals instead of Western style (0-9)
|
||||
// * numerals in interface.
|
||||
// */
|
||||
// $wgTranslateNumerals = true;
|
||||
//
|
||||
|
||||
/**
|
||||
* For Hindi and Arabic use local numerals instead of Western style (0-9)
|
||||
* numerals in interface.
|
||||
*/
|
||||
public static boolean wgTranslateNumerals = true;
|
||||
|
||||
// /**
|
||||
// * Translation using MediaWiki: namespace.
|
||||
// * Interface messages will be loaded from the database.
|
||||
|
@ -1108,7 +1108,7 @@ public class XomwMessage {
|
||||
* @return String
|
||||
*/
|
||||
// DFLT:type="before"
|
||||
// private byte[] replaceParameters(byte[] message, int prm_tid, int format) {
|
||||
// private byte[] replaceParameters(byte[] message, int type, int format) {
|
||||
// $replacementKeys = [];
|
||||
// foreach (this.parameters as $n => $param) {
|
||||
// list($paramType, $value) = this.extractParam($param, $format);
|
||||
@ -1141,30 +1141,29 @@ public class XomwMessage {
|
||||
case XomwMessagePrm.Tid__num:
|
||||
// Replace number prmsVar always in before step for now.
|
||||
// No support for combined raw and num prmsVar
|
||||
// rv.Set(PRM_TID_BEFORE, this.getLanguage().formatNum((XomwMessagePrm_num)prm).num);
|
||||
// return [PRM_TID_BEFORE, this.getLanguage()->formatNum($param['num']) ];
|
||||
rv.Set(PRM_TID_BEFORE, this.getLanguage().formatNum(((XomwMessagePrm_num)prm).numAsBry()));
|
||||
break;
|
||||
case XomwMessagePrm.Tid__duration:
|
||||
// case XomwMessagePrm.Tid__duration:
|
||||
// return [PRM_TID_BEFORE, this.getLanguage()->formatDuration($param['duration']) ];
|
||||
break;
|
||||
case XomwMessagePrm.Tid__expiry:
|
||||
// break;
|
||||
// case XomwMessagePrm.Tid__expiry:
|
||||
// return [PRM_TID_BEFORE, this.getLanguage()->formatExpiry($param['expiry']) ];
|
||||
break;
|
||||
case XomwMessagePrm.Tid__period:
|
||||
// break;
|
||||
// case XomwMessagePrm.Tid__period:
|
||||
// return [PRM_TID_BEFORE, this.getLanguage()->formatTimePeriod($param['period']) ];
|
||||
break;
|
||||
case XomwMessagePrm.Tid__size:
|
||||
// break;
|
||||
// case XomwMessagePrm.Tid__size:
|
||||
// return [PRM_TID_BEFORE, this.getLanguage()->formatSize($param['size']) ];
|
||||
break;
|
||||
case XomwMessagePrm.Tid__bitrate:
|
||||
// break;
|
||||
// case XomwMessagePrm.Tid__bitrate:
|
||||
// return [PRM_TID_BEFORE, this.getLanguage()->formatBitrate($param['bitrate']) ];
|
||||
break;
|
||||
case XomwMessagePrm.Tid__plaintext:
|
||||
// break;
|
||||
// case XomwMessagePrm.Tid__plaintext:
|
||||
// return [PRM_TID_AFTER, this.formatPlaintext($param['plaintext'], $format) ];
|
||||
break;
|
||||
case XomwMessagePrm.Tid__list:
|
||||
// break;
|
||||
// case XomwMessagePrm.Tid__list:
|
||||
// return this.formatListParam($param['list'], $param['type'], $format);
|
||||
break;
|
||||
// break;
|
||||
default:
|
||||
String warning = "Invalid parameter for message '" + this.getKey() + "': " +
|
||||
prm.toString();
|
||||
@ -1373,6 +1372,7 @@ class XomwMessagePrm_raw extends XomwMessagePrm { public byte[] raw;
|
||||
}
|
||||
}
|
||||
class XomwMessagePrm_num extends XomwMessagePrm { public int num;
|
||||
public byte[] numAsBry() {return Int_.To_bry(num);}
|
||||
public XomwMessagePrm_num(int num) {super(Tid__num);
|
||||
this.num = num;
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ class XomwMediaWikiTitleCodecFxt {
|
||||
public XomwLanguage Make_lang() {
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
Xol_lang_itm lang = new Xol_lang_itm(app.Lang_mgr(), Xol_lang_itm_.Key_en);
|
||||
XomwEnv env = new XomwEnv(lang);
|
||||
return new XomwLanguage(lang);
|
||||
}
|
||||
public void Test_splitTitleString(XomwMediaWikiTitleCodec codec, String src, XomwMediaWikiTitleCodecParts expd) {
|
||||
|
@ -47,7 +47,7 @@ public class XomwLanguage {
|
||||
// /**
|
||||
// * @var LocalisationCache
|
||||
// */
|
||||
// static public $dataCache;
|
||||
// static public $dataCache; // equivalent to MessagesLangCode.php
|
||||
//
|
||||
// static public $mLangObjCache = [];
|
||||
//
|
||||
@ -3267,49 +3267,52 @@ public class XomwLanguage {
|
||||
// function emphasize($text) {
|
||||
// return "<em>$text</em>";
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Normally we output all numbers in plain en_US style, that is
|
||||
// * 293,291.235 for twohundredninetythreethousand-twohundredninetyone
|
||||
// * point twohundredthirtyfive. However this is not suitable for all
|
||||
// * languages, some such as Bengali (bn) want ২,৯৩,২৯১.২৩৫ and others such as
|
||||
// * Icelandic just want to use commas instead of dots, and dots instead
|
||||
// * of commas like "293.291,235".
|
||||
// *
|
||||
// * An example of this function being called:
|
||||
// * <code>
|
||||
// * wfMessage('message')->numParams($num)->text()
|
||||
// * </code>
|
||||
// *
|
||||
// * See $separatorTransformTable on MessageIs.php for
|
||||
// * the , => . and . => , implementation.
|
||||
// *
|
||||
// * @todo check if it's viable to use localeconv() for the decimal separator thing.
|
||||
// * @param int|float $number The String to be formatted, should be an integer
|
||||
// * or a floating point number.
|
||||
// * @param boolean $nocommafy Set to true for special numbers like dates
|
||||
// * @return String
|
||||
// */
|
||||
// public function formatNum($number, $nocommafy = false) {
|
||||
// global $wgTranslateNumerals;
|
||||
// if (!$nocommafy) {
|
||||
// $number = this.commafy($number);
|
||||
// $s = this.separatorTransformTable();
|
||||
// if ($s) {
|
||||
// $number = strtr($number, $s);
|
||||
|
||||
/**
|
||||
* Normally we output all numbers in plain en_US style, that is
|
||||
* 293,291.235 for twohundredninetythreethousand-twohundredninetyone
|
||||
* point twohundredthirtyfive. However this is not suitable for all
|
||||
* languages, some such as Bengali (bn) want ২,৯৩,২৯১.২৩৫ and others such as
|
||||
* Icelandic just want to use commas instead of dots, and dots instead
|
||||
* of commas like "293.291,235".
|
||||
*
|
||||
* An example of this function being called:
|
||||
* <code>
|
||||
* wfMessage('message')->numParams($num)->text()
|
||||
* </code>
|
||||
*
|
||||
* See $separatorTransformTable on MessageIs.php for
|
||||
* the , => . and . => , implementation.
|
||||
*
|
||||
* @todo check if it's viable to use localeconv() for the decimal separator thing.
|
||||
* @param int|float $number The String to be formatted, should be an integer
|
||||
* or a floating point number.
|
||||
* @param boolean $nocommafy Set to true for special numbers like dates
|
||||
* @return String
|
||||
*/
|
||||
// DFLT:nocommafy=false
|
||||
public byte[] formatNum(byte[] number) {return formatNum(number, false);}
|
||||
public byte[] formatNum(byte[] number, boolean nocommafy) {
|
||||
if (!nocommafy) {
|
||||
// XOMW: use earlier port
|
||||
// number = this.commafy(number);
|
||||
// s = this.separatorTransformTable();
|
||||
// if (s) {
|
||||
// number = strtr(number, s);
|
||||
// }
|
||||
return xoLang.Num_mgr().Format_num(number, nocommafy);
|
||||
}
|
||||
|
||||
if (XomwDefaultSettings.wgTranslateNumerals) {
|
||||
// s = this.digitTransformTable();
|
||||
// if (s) {
|
||||
// number = strtr(number, s);
|
||||
// }
|
||||
//
|
||||
// if ($wgTranslateNumerals) {
|
||||
// $s = this.digitTransformTable();
|
||||
// if ($s) {
|
||||
// $number = strtr($number, $s);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return $number;
|
||||
// }
|
||||
//
|
||||
}
|
||||
|
||||
return number;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Front-end for non-commafied formatNum
|
||||
// *
|
||||
@ -3512,14 +3515,14 @@ public class XomwLanguage {
|
||||
// function digitTransformTable() {
|
||||
// return self::$dataCache->getItem(this.mCode, 'digitTransformTable');
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return array
|
||||
// */
|
||||
// function separatorTransformTable() {
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
// private byte[][] separatorTransformTable() {
|
||||
// return self::$dataCache->getItem(this.mCode, 'separatorTransformTable');
|
||||
// }
|
||||
//
|
||||
|
||||
// /**
|
||||
// * Take a list of strings and build a locale-friendly comma-separated
|
||||
// * list, using the local comma-separator message.
|
||||
|
@ -118,6 +118,7 @@ class XomwLanguageFxt {
|
||||
public XomwLanguageFxt() {
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
Xol_lang_itm xoLang = new Xol_lang_itm(app.Lang_mgr(), Bry_.new_a7("en"));
|
||||
XomwEnv env = new XomwEnv(xoLang);
|
||||
this.lang = new XomwLanguage(xoLang);
|
||||
}
|
||||
public void Init_digitGroupingPattern(String digitGroupingPattern) {
|
||||
|
@ -1 +1 @@
|
||||
blog_new_job[D[D[D[D[D[D[D_
|
||||
update
|
||||
|
Loading…
Reference in New Issue
Block a user