mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Make lazy loading message be translateable
This commit is contained in:
parent
f405a89b28
commit
ecdae4ceff
@ -20,6 +20,7 @@ Encryption/RepeatPassword: Repeat password
|
||||
Encryption/PasswordNoMatch: Passwords do not match
|
||||
Encryption/SetPassword: Set password
|
||||
InvalidFieldName: Illegal characters in field name "<$text text=<<fieldName>>/>". Fields can only contain lowercase letters, digits and the characters underscore (`_`), hyphen (`-`) and period (`.`)
|
||||
LazyLoadingWarning: <p>Loading external text from ''<$text text={{!!_canonical_uri}}/>''</p><p>If this message doesn't disappear you may be using a browser that doesn't support external text in this configuration. See http://tiddlywiki.com/#ExternalText</p>
|
||||
MissingTiddler/Hint: Missing tiddler "<$text text=<<currentTiddler>>/>" - click {{$:/core/images/edit-button}} to create
|
||||
OfficialPluginLibrary: Official ~TiddlyWiki Plugin Library
|
||||
PluginReloadWarning: Please save {{$:/core/ui/Buttons/save-wiki}} and reload {{$:/core/ui/Buttons/refresh}} to allow changes to plugins to take effect
|
||||
|
@ -22,7 +22,7 @@ function Language(options) {
|
||||
}
|
||||
|
||||
/*
|
||||
Return a single translateable string. The title is automatically prefixed with "$:/language/"
|
||||
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
|
||||
*/
|
||||
@ -32,6 +32,14 @@ Language.prototype.getString = function(title,options) {
|
||||
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;
|
||||
|
||||
})();
|
||||
|
@ -28,20 +28,9 @@ var WikiParser = function(type,text,options) {
|
||||
this.wiki = options.wiki;
|
||||
var self = this;
|
||||
// Check for an externally linked tiddler
|
||||
if($tw.browser && options._canonical_uri) {
|
||||
$tw.utils.httpRequest({
|
||||
url: options._canonical_uri,
|
||||
type: "GET",
|
||||
callback: function(err,data) {
|
||||
if(!err) {
|
||||
var tiddlers = self.wiki.deserializeTiddlers(".tid",data,self.wiki.getCreationFields())
|
||||
if(tiddlers) {
|
||||
self.wiki.addTiddlers(tiddlers);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
text = "Loading external text from ''" + options._canonical_uri + "''\n\nIf this message doesn't disappear you may be using a browser that doesn't support external text in this configuration. See http://tiddlywiki.com/#ExternalText";
|
||||
if($tw.browser && (text || "") === "" && options._canonical_uri) {
|
||||
this.loadRemoteTiddler(options._canonical_uri);
|
||||
text = $tw.language.getRawString("LazyLoadingWarning");
|
||||
}
|
||||
// Initialise the classes if we don't have them already
|
||||
if(!this.pragmaRuleClasses) {
|
||||
@ -79,6 +68,27 @@ var WikiParser = function(type,text,options) {
|
||||
// Return the parse tree
|
||||
};
|
||||
|
||||
/*
|
||||
*/
|
||||
WikiParser.prototype.loadRemoteTiddler = function(url) {
|
||||
var self = this;
|
||||
$tw.utils.httpRequest({
|
||||
url: url,
|
||||
type: "GET",
|
||||
callback: function(err,data) {
|
||||
if(!err) {
|
||||
var tiddlers = self.wiki.deserializeTiddlers(".tid",data,self.wiki.getCreationFields());
|
||||
$tw.utils.each(tiddlers,function(tiddler) {
|
||||
tiddler["_canonical_uri"] = url;
|
||||
});
|
||||
if(tiddlers) {
|
||||
self.wiki.addTiddlers(tiddlers);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
*/
|
||||
WikiParser.prototype.setupRules = function(proto,configPrefix) {
|
||||
|
Loading…
Reference in New Issue
Block a user