mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-28 13:43:15 +00:00

* remove blks first try * dprint.json seems to be OK, some forgotten functions * add some more space-after-keyword settings * server remove blks * add **/files to dprint exclude * dprint.js fixes a typo * add boot.js and bootprefix.js to dprint exclude * dprint change dprint.json * add dprint fmt as script * remove jslint comments * fix whitespace * fix whitespace * remove function-wrapper from geospatial plugin * fix whitespace * add function wrapper to dyannotate-startup * remove dpring.json
41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
/*\
|
|
title: $:/core/modules/language.js
|
|
type: application/javascript
|
|
module-type: global
|
|
|
|
The $tw.Language() manages translateable strings
|
|
|
|
\*/
|
|
|
|
"use strict";
|
|
|
|
/*
|
|
Create an instance of the language manager. Options include:
|
|
wiki: wiki from which to retrieve translation tiddlers
|
|
*/
|
|
function Language(options) {
|
|
options = options || "";
|
|
this.wiki = options.wiki || $tw.wiki;
|
|
}
|
|
|
|
/*
|
|
Return a wikified translateable string. The title is automatically prefixed with "$:/language/"
|
|
Options include:
|
|
variables: optional hashmap of variables to supply to the language wikification
|
|
*/
|
|
Language.prototype.getString = function(title,options) {
|
|
options = options || {};
|
|
title = "$:/language/" + title;
|
|
return this.wiki.renderTiddler("text/plain",title,{variables: options.variables});
|
|
};
|
|
|
|
/*
|
|
Return a raw, unwikified translateable string. The title is automatically prefixed with "$:/language/"
|
|
*/
|
|
Language.prototype.getRawString = function(title) {
|
|
title = "$:/language/" + title;
|
|
return this.wiki.getTiddlerText(title);
|
|
};
|
|
|
|
exports.Language = Language;
|