mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
shorter message for untranslated strings
This commit is contained in:
parent
cc27c5f363
commit
934ede7d91
app
assets/javascripts
views
@ -248,4 +248,3 @@ Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
|
||||
});
|
||||
|
||||
Discourse.Router = Discourse.Router.reopen({ location: 'discourse_location' });
|
||||
|
||||
|
@ -8,5 +8,3 @@ window.ENV = {
|
||||
|
||||
window.Discourse = {};
|
||||
Discourse.SiteSettings = {};
|
||||
|
||||
|
||||
|
@ -60,8 +60,7 @@ I18n.locale = null;
|
||||
// Set the placeholder format. Accepts `{{placeholder}}` and `%{placeholder}`.
|
||||
I18n.PLACEHOLDER = /(?:\{\{|%\{)(.*?)(?:\}\}?)/gm;
|
||||
|
||||
I18n.fallbackRules = {
|
||||
};
|
||||
I18n.fallbackRules = {};
|
||||
|
||||
I18n.pluralizationRules = {
|
||||
en: function (n) {
|
||||
@ -207,7 +206,7 @@ I18n.translate = function(scope, options) {
|
||||
} else {
|
||||
return this.interpolate(translation, options);
|
||||
}
|
||||
} catch(err) {
|
||||
} catch (error) {
|
||||
return this.missingTranslation(scope);
|
||||
}
|
||||
};
|
||||
@ -485,15 +484,9 @@ I18n.findAndTranslateValidNode = function(keys, translation) {
|
||||
I18n.pluralize = function(count, scope, options) {
|
||||
var translation;
|
||||
|
||||
try {
|
||||
translation = this.lookup(scope, options);
|
||||
} catch (error) {}
|
||||
try { translation = this.lookup(scope, options); } catch (error) {}
|
||||
if (!translation) { return this.missingTranslation(scope); }
|
||||
|
||||
if (!translation) {
|
||||
return this.missingTranslation(scope);
|
||||
}
|
||||
|
||||
var message;
|
||||
options = this.prepareOptions(options);
|
||||
options.count = count.toString();
|
||||
|
||||
@ -501,24 +494,16 @@ I18n.pluralize = function(count, scope, options) {
|
||||
var key = pluralizer(Math.abs(count));
|
||||
var keys = ((typeof key == "object") && (key instanceof Array)) ? key : [key];
|
||||
|
||||
message = this.findAndTranslateValidNode(keys, translation);
|
||||
var message = this.findAndTranslateValidNode(keys, translation);
|
||||
if (message == null) message = this.missingTranslation(scope, keys[0]);
|
||||
|
||||
return this.interpolate(message, options);
|
||||
};
|
||||
|
||||
I18n.missingTranslation = function() {
|
||||
var message = '[missing "' + this.currentLocale()
|
||||
, count = arguments.length
|
||||
;
|
||||
|
||||
for (var i = 0; i < count; i++) {
|
||||
message += "." + arguments[i];
|
||||
}
|
||||
|
||||
message += '" translation]';
|
||||
|
||||
return message;
|
||||
I18n.missingTranslation = function(scope, key) {
|
||||
var message = '[' + this.currentLocale() + "." + scope;
|
||||
if (key) { message += "." + key; }
|
||||
return message + ']';
|
||||
};
|
||||
|
||||
I18n.currentLocale = function() {
|
||||
|
@ -7,23 +7,16 @@
|
||||
'defer/google_diff_match_patch': <%= asset_path('defer/google_diff_match_patch.js').inspect.html_safe %>
|
||||
};
|
||||
|
||||
var assetPath = function(asset){
|
||||
return map[asset];
|
||||
};
|
||||
|
||||
return assetPath;
|
||||
return function(asset){ return map[asset]; };
|
||||
})();
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
Discourse.CDN = '<%= Rails.configuration.action_controller.asset_host %>';
|
||||
Discourse.BaseUrl = '<%= RailsMultisite::ConnectionManagement.current_hostname %>';
|
||||
Discourse.CDN = '<%= Rails.configuration.action_controller.asset_host %>';
|
||||
Discourse.BaseUrl = '<%= RailsMultisite::ConnectionManagement.current_hostname %>';
|
||||
Discourse.BaseUri = '<%= Discourse::base_uri "/" %>';
|
||||
Discourse.Environment = '<%= Rails.env %>';
|
||||
Discourse.SiteSettings = PreloadStore.get('siteSettings');
|
||||
Discourse.Router.map(function() {
|
||||
Discourse.routeBuilder.call(this);
|
||||
});
|
||||
Discourse.Router.map(function() { Discourse.routeBuilder.call(this); });
|
||||
Discourse.start()
|
||||
</script>
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
<link rel="icon" type="image/png" href="<%=SiteSetting.favicon_url%>">
|
||||
<link rel="apple-touch-icon" type="image/png" href="<%=SiteSetting.apple_touch_icon_url%>">
|
||||
|
||||
<%= javascript_include_tag "preload_store" %>
|
||||
|
||||
<%= javascript_include_tag "locales/#{I18n.locale}" %>
|
||||
|
Loading…
Reference in New Issue
Block a user