Constructor
new LanguageConverter(langobj, maincode, variants, variantfallbacks, flags, manualLevel)
Parameters:
Name | Type | Description |
---|---|---|
langobj |
Language | |
maincode |
string | The main language code of this language |
variants |
Array.<string> | The supported variants of this language |
variantfallbacks |
Map | The fallback language of each variant |
flags |
Map | Defining the custom strings that maps to the flags |
manualLevel |
Map | Limit for supported variants |
- Source:
Methods
(static) baseToVariant(env, rootNode, targetVariant, sourceVariantopt)
Convert a text in the "base variant" to a specific variant, given
by targetVariant
.
Convert a text in the "base variant" to a specific variant, given
by targetVariant
. If sourceVariant
is given, assume that the
input wikitext is in sourceVariant
to construct round-trip
metadata, instead of using a heuristic to guess the best variant
for each DOM subtree of wikitext.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
env |
MWParserEnvironment | ||
rootNode |
Node | The root node of a fragment to convert. |
|
targetVariant |
string | The variant to be used for the output DOM. |
|
sourceVariant |
string |
<optional> |
An optional variant assumed for the input DOM in order to create roundtrip metadata. |
- Source:
(static) classFromCode(code, fallback) → {string}
Try to return a classname from a given code.
Parameters:
Name | Type | Description |
---|---|---|
code |
string | |
fallback |
boolean | Whether we're going through language fallback |
- Source:
Returns:
Name of the language class (if one were to exist)
- Type
- string
getMachine() → {ReplacementMachine}
Return the ReplacementMachine powering this conversion. Parsoid-specific.
- Source:
Returns:
- Type
- ReplacementMachine