Skip to content

Commit

Permalink
jsxref shouldn't localize slugs (#3132)
Browse files Browse the repository at this point in the history
* jsxref shouldn't localize slugs

* delete refs
  • Loading branch information
peterbe authored Mar 4, 2021
1 parent d47fdf4 commit b23b659
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 32 deletions.
20 changes: 0 additions & 20 deletions kumascript/macros/L10n-JavaScript.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
{
"slug_reference": {
"en-US": "Reference",
"es": "Referencia",
"de": "Reference",
"fr": "Reference",
"ca": "Referencia",
"pl": "Referencje",
"ru": "Reference"
},

"slug_global_objects": {
"en-US": "Global_Objects",
"es": "Objetos_globales",
"de": "Global_Objects",
"fr": "Objets_globaux",
"ca": "Objectes_globals",
"pl": "Obiekty",
"ru": "Global_Objects"
},

"stdlib": {
"en-US": "Standard built-in objects",
"fr": "Objets standards",
Expand Down
19 changes: 7 additions & 12 deletions kumascript/macros/jsxref.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,24 @@
// {{jsxref("Global_Objects/Date/getNumber", "Date.prototype.getNumber()")}}
//
let jsl10n = JSON.parse(await template('L10n:JavaScript'));
let l10n = {
refslug: mdn.getLocalString(jsl10n, 'slug_reference'),
slug: mdn.getLocalString(jsl10n, 'slug_global_objects'),
};
const slug = 'Global_Objects';
let str = $1 || $0;
let URL = "/" + env.locale + "/docs/Web/JavaScript/" + l10n.refslug + '/';
let URL = `/${env.locale}/docs/Web/JavaScript/Reference/`;
let basePath = URL;
let api = $0.replace('()', '').replace('.prototype.', '.');
let page = wiki.getPage(URL + $0);
let objectPage = wiki.getPage(URL + l10n.slug + '/' + $0);
let objectPage = wiki.getPage(URL + slug + '/' + $0);
if ((api.indexOf("..") === -1) && (api.indexOf(".") !== -1)) { // Handle try...catch case
basePath += l10n.slug + '/';
URL += l10n.slug + '/' + api.replace('.', '/');
basePath += slug + '/';
URL += slug + '/' + api.replace('.', '/');
} else if (!page.slug && objectPage.slug) {
basePath += l10n.slug + '/';
URL += l10n.slug + '/' + $0;
basePath += slug + '/';
URL += slug + '/' + $0;
} else {
URL += web.safeDecodeURIComponent($0);
}
Expand Down

0 comments on commit b23b659

Please sign in to comment.