internationalization

JavaScript: Format number/currency w/regards to culture like .NET's String.Format()?

最后都变了- 提交于 2019-12-06 04:50:51
问题 This seems like a problem someone would've already solved in the year 2009, but I can't find a decent JavaScript library that will take a number like: 12345.58 And format it correctly based on a specific culture (ie, "nl-nl") or ISO currency code. dojo showed promise, but it doesn't include many cultures by default, and actually wasn't working properly in my tests. I basically want something that is 100% or near-100% equivalent to what .NET does for me, when I run: String.Format([cultureInfo

Return Custom Validator Error Grails

血红的双手。 提交于 2019-12-06 04:49:38
问题 I'm only getting the default validator message. What am I doing wrong? class Questao { static hasMany = [alternativas:Alternativa] static constraints = { alternativas (validator: {val, obj -> if(val.size() < 2) return ['validator.message'] //custom message }) } } /i18n questao.alternativas.validator.message = "must be greater than two" default.invalid.validator.message= Property [{0}] of class [{1}] with value [{2}] does not pass custom validation Thanks 回答1: You're returning a list

i18n translation in JSP custom tag

走远了吗. 提交于 2019-12-06 04:36:32
Is it possible to write a custom JSP tag to take an i18n message key and output the translation phrase for the given request? Normally in JSP/JSTL, I do: <fmt:message key="${messageKey}"><fmt:param>arg1</fmt:param></fmt:message> And I get the translation phrase. Now I need to do the following (there's a good reason for this): <custom:translate key="${messageKey}" arg="arg1"/> But I don't know how to look up the translation in the custom tag code. The TagSupport base class provides a pageContext from which I can get a ServletRequest which has the Locale... but how do I then look up the

Excel DATEVALUE function independent of international settings

断了今生、忘了曾经 提交于 2019-12-06 04:22:00
In my Excel workbook, I copy some date information from another (text) source. To be able to do calculations with these dates, I use the function "DATEVALUE". Example: cell A1 contains the text 20 february 2014 , cell B1 contains the formula =DATEVALUE(A1) . This works as expected: I get the number of days since 1-1-1900, which I can display in any date notation imaginable. No problem so far. Even through this is not a typical date notation in the English language, DATEVALUE recognizes february as the month name and acts accordingly. Now, when I open this workbook on a computer with different

When line of text starts with a number, a number shows up on right in RTL mode. Why?

偶尔善良 提交于 2019-12-06 04:12:38
Try pasting the following html snippet into a new tab in your browser: data:text/html,<html dir=rtl>5 little ducks went out to play. The text outputs, right aligned, like so: .little ducks went out to play 5 Why is the 5 being moved to the end of the line? If I change the 5 to a non-numeric value, such as 5a , the text displays as I would expect: .5a little ducks when out to play I've reproduced it in both Chrome and Firefox on Ubuntu, so I am assuming that it is not a browser bug. My locale is en-US and I have the encoding set to UTF-8. A few more examples make this seem even stranger. If the

Spring Security with AcceptHeaderLocaleResolver and i18n

允我心安 提交于 2019-12-06 04:08:09
问题 I am stuck, probably missed something in docs or made some small mistake. Spring Security 3.0.5 was integrated in my Spring MVC 3.0.5 app. AcceptHeaderLocaleResolver is used for Locale detection and localisation works ok except for Security error messages. I copied messages.properties from spring security package and renamed and added to existing "messageSource" bean (ResourceBundleMessageSource) with value list. As said earlier all texts and messages are localised correctly, except Security

Displaying a unicode text in C#

空扰寡人 提交于 2019-12-06 04:03:32
问题 My App displays English, Japanese and Chinese characters on a TextBox and a LinkLabel. Currently, I check if there are unicode characters and change the font to MS Mincho or else leave it in Tahoma. Now MS Mincho displays Japanese properly, but for Chinese I have to use Sim Sun. How can I distinguish between the two? How can I ensure that unicode text are displayed properly regardless of the font/language? 回答1: If you have unicode characters for each of the text, using a font that supports

Java Regular Expression with International Letters

匆匆过客 提交于 2019-12-06 04:03:03
问题 Here's my current code: return str.matches("^[A-Za-z\\-'. ]+"); I want it to include international letters. How do I do that in Java? Thanks. 回答1: It seems that you want is, to match all the alphabetic characters. Typically you would do that by using Posix \p{Alpha} expression, extended by the punctuation you want also to permit. As Java Regular Expressions documentation says, it matches ASCII only. However, what documentation does not say clearly is, you can make this class work with Unicode

How to set and handle language in react-router from?

旧城冷巷雨未停 提交于 2019-12-06 03:57:46
问题 I have been trying to resolve this all day and finally i come to you all. The task is simple, I need to set language type in the URL, so it looks something like this: domain.com/{langVar}/other/paths And be able to change it by clicking/selecting language in my apps header or any other component. Important: the language variable should always remain in the URL. I am using "react-router": "^2.7.0", "react": "^15.3.1". This is how my router config looks like: export default ( <Router history=

Jinja2 translation of links

一个人想着一个人 提交于 2019-12-06 03:56:37
问题 From a Jinja2 template, this is the rendered line I'm after (in English): This is the <a href="roadmap.html">roadmap</a> Translated in Dutch should result in: Dit is de <a href="roadmap.html">planning</a> This Jinja2 line gets me there -almost- {{ _('This is the %(roadmap)s.', roadmap='<a href="roadmap.html">roadmap</a>'|safe) }} Unfortunately, the word 'roadmap' is not translated. What would be the Jinja2 way of accomplishing this? Splitting the link in roadmap1 and roadmap2? I hope for