translate

Translation in JavaScript like gettext in PHP?

≯℡__Kan透↙ 提交于 2019-11-27 18:32:28
I am using gettext in my PHP code, but I have a big problem. All my JavaScript files are not affected by the translation, can somebody tell me an easy way to get the translations in the chosen language into JavaScript as well. The easiest way is having a PHP file write the translations from gettext into JavaScript variables. js_lang.php: word_hello = "<?php echo gettext("hello"); ?>" word_world = "<?php echo gettext("world"); ?>" word_how_are_you = "<?php echo gettext("how_are_you"); ?>" and then include it: <script type="text/javascript" src="js_lang.php"></script> I would also recommend this

Scaled live iPhone Camera view in center, “CGAffineTransformTranslate” not working

烈酒焚心 提交于 2019-11-27 15:13:00
问题 I have a little problem which I could not solve. I really hope someone can help me with that. I wanted to resize the live camera view and place it in the center, using the following code below: picker.cameraViewTransform = CGAffineTransformScale(picker.cameraViewTransform, 0.5, 0.56206); picker.cameraViewTransform = CGAffineTransformTranslate(picker.cameraViewTransform, 80, 120); But all I got was a scaled 1/2 sized view on the top left of the screen. It seems as though

CSS3 Translate across an Arc

Deadly 提交于 2019-11-27 11:30:04
问题 Is it at all possible with current CSS3 to translate an object (specifically a DIV) along an arc or curve? Here's an image to help illustrate. 回答1: You can use nested elements and make the wrapper and inner element rotate in opposite directions so that the rotation of the inner element compensates for the rotation of the wrapper. If you don't need to keep the nested element horizontal, you can omit the inner rotation. Here is a Dabblet. Stack Snippet: /* Arc movement */ .wrapper { width:

Building a parser (Part I)

谁说胖子不能爱 提交于 2019-11-27 09:47:21
问题 I'm making my own javascript-based programming language (yeah, it is crazy, but it's for learn only... maybe? ). Well, I'm reading about parsers and the first pass is to convert the code source to tokens, like: if(x > 5) return true; Tokenizer to: T_IF "if" T_LPAREN "(" T_IDENTIFIER "x" T_GT ">" T_NUMBER "5" T_RPAREN ")" T_IDENTIFIER "return" T_TRUE "true" T_TERMINATOR ";" I don't know if my logic is correct for that for while. On my parser it is even better ( or not? ) and translate to it

Two conditions using OR in XPATH

假如想象 提交于 2019-11-27 09:01:21
I have a textbox, 'txtSearch'. I am using it to search people by Last Name. this is my code. var xmlTempResultSearch = xmlResidentListDisplay.selectNodes( "//PeopleList/Row[contains(translate(@LastName, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), '" + txtSearch.value + "')]"); This code selects all last names in the XML like the text input in the txtSearch textbox. This translates all uppercase letters to lowercase letters. So if I am searching for 'Dorosan', if I type 'doro', it retrieves the correct person because it translated the 'D' to 'd'. But when I type 'Doro', it

XSL Multiple search and replace function

爱⌒轻易说出口 提交于 2019-11-27 03:38:44
问题 I am attempting to use the XSL translate() function to create something like a search and replace function as follows: <xsl:template name="create-id"> <xsl:param name="id" /> <xsl:call-template name="search-and-replace"> <xsl:with-param name="str" select="$id" /> <xsl:with-param name="search">0123456789</xsl:with-param> <xsl:with-param name="replace">abcdefghij</xsl:with-param> </xsl:call-template> </xsl:template> <xsl:template name="search-and-replace"> <xsl:param name="str" /> <xsl:param

How to have a translation service in android app

孤街醉人 提交于 2019-11-27 03:05:34
问题 How can a translation service be called in an Android app? Can we have an app that can translate multiple languages into another? 回答1: Edit - Google have deprecated the Translation API due to "misuse". Apertium is a possible alternative. You asked: How can a translation service be called in an Android app? Google Translate would seem to be the obvious service to use in an Android App. There is an unofficial Java client API you could use in your application to make the calls to Google

Unescaping XML entities using XmlReader in .NET?

六眼飞鱼酱① 提交于 2019-11-27 02:54:11
问题 I'm trying to unescape XML entities in a string in .NET (C#), but I don't seem to get it to work correctly. For example, if I have the string AT&T , it should be translated to AT&T . One way is to use HttpUtility.HtmlDecode(), but that's for HTML. So I have two questions about this: Is it safe to use HttpUtility.HtmlDecode() for decoding XML entities? How do I use XmlReader (or something similar) to do this? I have tried the following, but that always returns an empty string: static string

Translate X and Y percentage values based on elements height and width?

五迷三道 提交于 2019-11-27 00:59:06
问题 Translating an elements Y axis 50% will move it down 50% of its own height, not 50% of the parents height as I would expect. How do I tell a translating element to base it's translation percentage on the parent element? Or am I not understanding something? http://jsfiddle.net/4wqEm/2/ 回答1: When using percentage in translate, it refers to width or height of itself. Take a look at https://davidwalsh.name/css-vertical-center (demo): One interesting thing about CSS transforms is that, when

Android ImageView Scaling and translating issue

ぐ巨炮叔叔 提交于 2019-11-25 21:54:59
问题 I’m developing an android application (API 19 4.4) and I encounter some issue with ImageViews. I have a SurfaceView, in which I dynamically add ImageViews which I want to react to touch events. On so far, I have managed to make the ImageView move and scale smoothly but I have an annoying behavior. When I scale down the image to a certain limit (I would say half the original size) and I try to move it, the image flicker. After a short analysis, it seems that it’s switching its position