fallback

Gettext fallbacks don't work with untranslated strings

拥有回忆 提交于 2020-01-05 12:45:55
问题 In source code of my application I wrapped with gettext strings in russian, so this is my default language and *.po files based on it. Now I need to make fallbacks chain - string that doesn’t translated in spanish catalog should be searched in english catalog and than if it doesn’t translated will be returned itself in russian . I trying to do this with add_fallback method, but untranslated strings in self._catalog of GNUTranslations(NullTranslations) already replaced with itself and ugettext

How do I specify fallback fonts in Java2D/Graphics2D

最后都变了- 提交于 2019-12-30 06:12:12
问题 I'm using g.drawString(str, x, y) to draw a String with a Graphics2D object g . The current font of g does not cover all the characters of str (I have e.g. Chinese chars in there). On Mac OS X, a fallback font seems to be automatically used, but not on Windows, where black square outlines appear instead of the wanted characters. Why is the behavior different depending on the platform? How do I specify a fallback font (or several fallback fonts) in case of missing characters? (For instance,

How to use fallback values for `display` property in CSS?

和自甴很熟 提交于 2019-12-24 13:42:55
问题 I want to use display: inline-table and display: table-cell , but it doesn't work on old browsers like IE7, so I want a display: inline-block fallback. According to http://afshinm.name/css-fallback-properties-better-cross-browser-compatibility/, with color property it's possible to use .me { color: #ccc; color: rgba(0, 0, 0, 0.5); } Then, I tried #wrapper { display: inline-block; display: inline-table; } #wrapper > .child { display: inline-block; display: table-cell; } but IE7 tries to use

Submit form with anchor + javascript - bad practice?

帅比萌擦擦* 提交于 2019-12-23 17:52:39
问题 I currently have two anchor tags sending url queries to put votes inside a database, but i want to switch to using forms to keep the urls clean and avoid duplicate queries (not really an issue, but makes it look ugly). Now the anchors need to contain a span-tag inside to add additional background elements to the buttons (links) through css, therefore I can't use regular form-buttons. Do you consider submitting these forms from the anchors with javascipt as bad practice? I can think of some

Globalize3 order records by translated attributes and taking fallbacks into consideration

随声附和 提交于 2019-12-23 12:35:34
问题 Im having troubles with awesome Globalize3 gem. For now I`m having two languages :en and :ru. And :ru falls back to :en like this #/config/initializers/globalize.rb Globalize.fallbacks = {:ru => [:ru, :en]} In my controller I am trying to sort the whole collection of translated records either by name translations or by translations fallback values. But with_translations() does not seem to give me such opportunity! Country.with_translations(:ru).order('country_translations.name ASC') #this

How to use fallback source on ScriptTagHelper and LinkTagHelper correctly

≡放荡痞女 提交于 2019-12-22 08:34:01
问题 I have read following posts from Damian Edwards. https://github.com/aspnet/Mvc/issues/1576 https://github.com/aspnet/Mvc/issues/1580 At the ScriptTagHelper , I'm not sure what I should enter on asp-fallback-test attribute ? It's the same as for jQuery ? window.jQuery ? How do I find the correct JavaScript Expression? Can someone give me an example based on moment-withlocales.min.js ? Thanks! Is following example for the LinkTagHelper correct? <link rel="stylesheet" href="https://cdn.jsdelivr

Fallback (default) image using Angular JS ng-src

折月煮酒 提交于 2019-12-22 03:22:44
问题 I'm trying to set an image source using data returned from a modal. This is inside an ng-repeat loop: <div id="divNetworkGrid"> <div id="{{network.id}}" ng-repeat="network in networks"> <span> <table> <tr> <td class="imgContainer"> <img ng-src="{{ ('assets/img/networkicons/'+ network.actual + '.png') || 'assets/img/networkicons/default.png' }}"/> </td> </tr> </table> </span> </div> </div> As is apparent, I want to populate default.png when the network.actual model property is returned as null

Use Native ES6 and Transpiling When Needed

老子叫甜甜 提交于 2019-12-21 18:13:06
问题 Is there some way (using grunt, gulp, plain JS, node module, etc.) to do the following. Taking a JS file as input, build a series of browser specific files based upon the browser's current support of ES6 features and transpile the features that are not yet supported. I'd like to use the ES6 features that are available as they become available and transpile the ones that aren't to ES5. Also, for those of us that have the pleasure of dealing with older browsers (e.g. IE9, IE10, and soon to be

Use Native ES6 and Transpiling When Needed

落爺英雄遲暮 提交于 2019-12-21 18:12:28
问题 Is there some way (using grunt, gulp, plain JS, node module, etc.) to do the following. Taking a JS file as input, build a series of browser specific files based upon the browser's current support of ES6 features and transpile the features that are not yet supported. I'd like to use the ES6 features that are available as they become available and transpile the ones that aren't to ES5. Also, for those of us that have the pleasure of dealing with older browsers (e.g. IE9, IE10, and soon to be

JavaScript Variable fallback

喜夏-厌秋 提交于 2019-12-21 03:53:00
问题 Please can someone explain to me what this line of code does: var list = calls[ev] || (calls[ev] = {}); My best guess: It's setting the variable "list" with the value of calls.xxx, where xxx is a variable, ev. If calls[ev] doesn't exist, then it's creating it as an empty object and assigning that empty object to "list". Is that right? Why are the parenthesis being used? Where can I find out more info on using || when setting variables, and the use of parenthesis in this context? Thanks! 回答1: