1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Scribunto: Use local language's namespace name not canonical

This commit is contained in:
gnosygnu
2016-11-23 12:18:20 -05:00
parent 6e39f9979d
commit eb5173b3a0
4 changed files with 6 additions and 6 deletions

View File

@@ -215,7 +215,7 @@ public class Scrib_lib_title implements Scrib_lib {
rv[ 0] = Keyval_.new_("isLocal" , true); // title.isLocal; NOTE: always true; passing "http:" also returns true; not sure how to handle "Interwiki::fetch( $this->mInterwiki )->isLocal()"
rv[ 1] = Keyval_.new_("interwiki" , xwiki_str); // $title->getInterwiki(),
rv[ 2] = Keyval_.new_("namespace" , ns.Id()); // $ns,
rv[ 3] = Keyval_.new_("nsText" , Xow_ns_canonical_.To_canonical_or_local_as_str(ns)); // $title->getNsText(), NOTE: needed b/c some modules expect English "Template"; PAGE:sh.w:Koprno DATE:2015-11-08
rv[ 3] = Keyval_.new_("nsText" , ns.Name_db()); // $title->getNsText(), NOTE: must be local language's version; Russian "Шаблон" not English "Template"; PAGE:ru.w:Королевство_Нидерландов DATE:2016-11-23
rv[ 4] = Keyval_.new_("text" , ttl.Page_txt()); // $title->getText(),
rv[ 5] = Keyval_.new_("fragment" , ttl.Anch_txt()); // $title->getFragment(),
rv[ 6] = Keyval_.new_("thePartialUrl" , ttl.Page_db()); // $title->getPartialUrl(),

View File

@@ -33,9 +33,9 @@ public class Scrib_lib_title_tst {
@Test public void NewTitle_int() {
fxt.Test__proc__objs__nest(lib, Scrib_lib_title.Invk_newTitle, Object_.Ary(1234) , ttl_fast(0 , "", "1234", "", "", "1234"));
}
@Test public void NewTitle__foreign() {// PURPOSE: always return English name b/c some modules expect English "Template"; PAGE:sh.w:Koprno DATE:2015-11-08
@Test public void NewTitle__foreign() {// PURPOSE: must be local language's version; Russian "Шаблон" not English "Template"; PAGE:ru.w:Королевство_Нидерландов DATE:2016-11-23
fxt.Core().Wiki().Ns_mgr().Ns_template().Name_bry_(Bry_.new_a7("Template_in_nonenglish_name"));
fxt.Test__proc__objs__nest(lib, Scrib_lib_title.Invk_newTitle, Object_.Ary("A", "Template") , ttl_fast(10 , "Template", "A")); // "Template" not "Template_in_nonenglish_name"
fxt.Test__proc__objs__nest(lib, Scrib_lib_title.Invk_newTitle, Object_.Ary("A", "Template") , ttl_fast(10 , "Template_in_nonenglish_name", "A")); // "Template_in_nonenglish_name" not "Template"
}
@Test public void GetUrl() {
fxt.Test__proc__objs__flat(lib, Scrib_lib_title.Invk_getUrl, Object_.Ary("Main_Page", "fullUrl") , "//en.wikipedia.org/wiki/Main_Page");
@@ -44,7 +44,7 @@ public class Scrib_lib_title_tst {
fxt.Test__proc__objs__flat(lib, Scrib_lib_title.Invk_getUrl, Object_.Ary("Main_Page", "canonicalUrl") , "https://en.wikipedia.org/wiki/Main_Page");
// fxt.Test_scrib_proc_str(lib, Scrib_lib_title.Invk_getUrl, Object_.Ary("Main_Page", "fullUrl", "", "http") , "http://en.wikipedia.org/wiki/Main_Page"); // TODO_OLD
}
@Test public void GetUrl__args_many() { // PUPROSE: GetUrl sometimes passes in kvs for qry_args; fr.w:Wikip<EFBFBD>dia:Image_du_jour/Date; DATE:2013-12-24
@Test public void GetUrl__args_many() { // PUPROSE: GetUrl sometimes passes in kvs for qry_args; fr.w:Wikipédia:Image_du_jour/Date; DATE:2013-12-24
fxt.Test__proc__objs__flat(lib, Scrib_lib_title.Invk_getUrl, Object_.Ary("Main_Page", "canonicalUrl", Keyval_.Ary(Keyval_.new_("action", "edit"), Keyval_.new_("preload", "b"))), "https://en.wikipedia.org/wiki/Main_Page?action=edit&preload=b");
}
@Test public void MakeTitle() {