Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/bin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"type": "commonjs",
"imports": {
"#ts/*": "@mathjax/src/ts/*",
"#js/*": "@mathjax/src/cjs/*",
"#source/*": "@mathjax/src/components/cjs/*",
"#root/*": "@mathjax/src/cjs/components/cjs/*",
Expand Down
5 changes: 5 additions & 0 deletions components/mjs/a11y/explorer/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/a11y/explorer/__locales__/Component.js';
import data from '#ts/a11y/explorer/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/a11y/explorer/explorer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import './lib/explorer.js';
import './en.js';

import {ExplorerHandler} from '#js/a11y/explorer.js';
import {hasWindow} from '#js/util/context.js';
Expand Down
5 changes: 5 additions & 0 deletions components/mjs/a11y/semantic-enrich/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/a11y/semantic-enrich/__locales__/Component.js';
import data from '#ts/a11y/semantic-enrich/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/a11y/semantic-enrich/semantic-enrich.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import './lib/semantic-enrich.js';
import './en.js';

import {combineDefaults} from '#js/components/global.js';
import {EnrichHandler} from '#js/a11y/semantic-enrich.js';
Expand Down
5 changes: 5 additions & 0 deletions components/mjs/a11y/speech/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/a11y/speech/__locales__/Component.js';
import data from '#ts/a11y/speech/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/a11y/speech/speech.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import './lib/speech.js';
import './en.js';

import {combineDefaults} from '#js/components/global.js';
import {Package} from '#js/components/package.js';
Expand Down
5 changes: 5 additions & 0 deletions components/mjs/adaptors/linkedom/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/adaptors/linkedom/__locales__/Component.js';
import data from '#ts/adaptors/linkedom/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/adaptors/linkedom/linkedom.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import './lib/linkedom.js';
import './en.js';

import {linkedomAdaptor} from '#js/adaptors/linkedomAdaptor.js';

Expand Down
2 changes: 2 additions & 0 deletions components/mjs/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {HTMLHandler} from '#js/handlers/html/HTMLHandler.js';
import {browserAdaptor} from '#js/adaptors/browserAdaptor.js';
import {Package} from '#js/components/package.js';

import './en.js';

if (MathJax.startup) {
MathJax.startup.registerConstructor('HTMLHandler', HTMLHandler);
MathJax.startup.registerConstructor('browserAdaptor', browserAdaptor);
Expand Down
5 changes: 5 additions & 0 deletions components/mjs/core/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/core/__locales__/Component.js';
import data from '#ts/core/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
5 changes: 5 additions & 0 deletions components/mjs/input/mml/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/mathml/__locales__/Component.js';
import data from '#ts/input/mathml/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/input/mml/init.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import './lib/mml.js';
import './en.js';

import {MathML} from '#js/input/mathml.js';
export {MathML};
Expand Down
8 changes: 8 additions & 0 deletions components/mjs/input/tex/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/__locales__/Component.js';
import { COMPONENT as BASE } from '#js/input/tex/base/__locales__/Component.js';
import data from '#ts/input/tex/__locales__/en.json' with {type: 'json'};
import basedata from '#ts/input/tex/base/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
Locale.registerMessages(BASE, 'en', basedata);
1 change: 1 addition & 0 deletions components/mjs/input/tex/extensions/ams/ams.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/ams.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/ams/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/ams/__locales__/Component.js';
import data from '#ts/input/tex/ams/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/input/tex/extensions/bbox/bbox.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/bbox.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/bbox/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/bbox/__locales__/Component.js';
import data from '#ts/input/tex/bbox/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/begingroup.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/begingroup/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/begingroup/__locales__/Component.js';
import data from '#ts/input/tex/begingroup/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/bussproofs.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/bussproofs/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/bussproofs/__locales__/Component.js';
import data from '#ts/input/tex/bussproofs/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/input/tex/extensions/cases/cases.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/cases.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/cases/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/cases/__locales__/Component.js';
import data from '#ts/input/tex/cases/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/input/tex/extensions/color/color.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/color.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/color/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/color/__locales__/Component.js';
import data from '#ts/input/tex/color/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/input/tex/extensions/colortbl/colortbl.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/colortbl.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/colortbl/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/colortbl/__locales__/Component.js';
import data from '#ts/input/tex/colortbl/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/input/tex/extensions/empheq/empheq.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/empheq.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/empheq/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/empheq/__locales__/Component.js';
import data from '#ts/input/tex/empheq/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/extpfeil/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/extpfeil/__locales__/Component.js';
import data from '#ts/input/tex/extpfeil/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/input/tex/extensions/extpfeil/extpfeil.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/extpfeil.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/html/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/html/__locales__/Component.js';
import data from '#ts/input/tex/html/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/input/tex/extensions/html/html.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/html.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/mathtools/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/mathtools/__locales__/Component.js';
import data from '#ts/input/tex/mathtools/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/input/tex/extensions/mathtools/mathtools.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/mathtools.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/mhchem/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/mhchem/__locales__/Component.js';
import data from '#ts/input/tex/mhchem/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/input/tex/extensions/mhchem/mhchem.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import './lib/mhchem.js';
import './en.js';
import {fontExtension} from '../../extension.js';

fontExtension('[tex]/mhchem', 'mathjax-mhchem-font-extension');
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/newcommand/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/newcommand/__locales__/Component.js';
import data from '#ts/input/tex/newcommand/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/newcommand.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/physics/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/physics/__locales__/Component.js';
import data from '#ts/input/tex/physics/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/input/tex/extensions/physics/physics.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/physics.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/require/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/require/__locales__/Component.js';
import data from '#ts/input/tex/require/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/input/tex/extensions/require/require.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/require.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/setoptions/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/setoptions/__locales__/Component.js';
import data from '#ts/input/tex/setoptions/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/setoptions.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/textmacros/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/textmacros/__locales__/Component.js';
import data from '#ts/input/tex/textmacros/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/textmacros.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/unicode/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/unicode/__locales__/Component.js';
import data from '#ts/input/tex/unicode/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/input/tex/extensions/unicode/unicode.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/unicode.js';
import './en.js';
5 changes: 5 additions & 0 deletions components/mjs/input/tex/extensions/verb/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/input/tex/verb/__locales__/Component.js';
import data from '#ts/input/tex/verb/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/input/tex/extensions/verb/verb.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import './lib/verb.js';
import './en.js';
1 change: 1 addition & 0 deletions components/mjs/input/tex/tex.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import './lib/tex.js';
import './en.js';

import {registerTeX} from './register.js';
import {Loader} from '#js/components/loader.js';
Expand Down
5 changes: 5 additions & 0 deletions components/mjs/ui/menu/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Locale } from '#js/util/Locale.js';
import { COMPONENT } from '#js/ui/menu/__locales__/Component.js';
import data from '#ts/ui/menu/__locales__/en.json' with {type: 'json'};

Locale.registerMessages(COMPONENT, 'en', data);
1 change: 1 addition & 0 deletions components/mjs/ui/menu/menu.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import './lib/menu.js';
import './en.js';

import {combineDefaults} from '#js/components/global.js';
import {MenuHandler} from '#js/ui/menu/MenuHandler.js';
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"./*": "./*"
},
"imports": {
"#ts/*": "@mathjax/src/ts/*",
"#js/*": "@mathjax/src/mjs/*",
"#source/*": "@mathjax/src/components/mjs/*",
"#root/*": "@mathjax/src/mjs/components/mjs/*",
Expand Down Expand Up @@ -140,7 +141,7 @@
"build-mjs": "pnpm -s mjs:build",
"make-cjs-components": "pnpm -s cjs:components:make && pnpm -s cjs:bundle:finalize",
"make-mjs-components": "pnpm -s mjs:components:make",
"make-one": "make() { node components/bin/makeAll --no-subdirs $3 $4 --${2:-mjs} components/${2-:mjs}/$1; }; make",
"make-one": "make() { node components/bin/makeAll --no-subdirs $3 $4 --${2:-mjs} components/${2:-mjs}/$1; }; make",
"make-components": "pnpm -s make-mjs-components",
"compile": "pnpm -s compile-mjs",
"build": "pnpm -s build-mjs",
Expand Down
1 change: 1 addition & 0 deletions ts/util/Locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export class Locale {
cdata[locale] = Object.create(null);
}
Object.assign(cdata[locale], data);
this.locations[component][1].add(locale);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.locations[component][1].add(locale);
this.locations[component]?[1].add(locale);

This would avoid a cryptic error message if registerMessages is called when the component does not exist.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a use case you have in mind for when this might happen?

Also, shouldn't we produce an error message for this rather than silently ignore it?

}

/**
Expand Down
1 change: 1 addition & 0 deletions tsconfig/cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"outDir": "../cjs",
"module": "CommonJS",
"paths": {
"#ts/*": ["./*"],
"#js/*": ["../cjs/*"],
"#source/*": ["../components/cjs/*"],
"#root/*": ["../ts/components/cjs/*"],
Expand Down
1 change: 1 addition & 0 deletions tsconfig/mjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"module": "nodenext",
"moduleResolution": "nodenext",
"paths": {
"#ts/*": ["./*"],
"#js/*": ["../mjs/*"],
"#source/*": ["../components/mjs/*"],
"#root/*": ["../ts/components/mjs/*"],
Expand Down