internationalization

How do I detect a NumberDecimalSeparator in a KeyDown event (C#)

删除回忆录丶 提交于 2019-12-10 13:54:30
问题 I'm trying to see if the user has pressed a decimal separator in a text box, and either allow or suppress it depending on other parameters. The NumberdecimalSeparator returns as 46, or '.' on my US system. Many other countries use ',' as the separator. The KeyDown event sets the KeyValue to 190 when I press the period. Do I just continue to look for commas/periods, or is there a better way? 回答1: The call CultureInfo.CurrentUICulture.NumberFormat.NumberDecimalSeparator gets the decimal

String.Format consider locale or not?

做~自己de王妃 提交于 2019-12-10 13:03:40
问题 Is it true that String.Format works 2 ways: if we use built-in format such as C, N, P.... it will take locale settings into account? if we use custom format code such as #,##0.000 it will NOT take locale settings into account? In my code, I use method like this String.Format("{0:#.##0,000}", value); because my country use comma as decimal separator but the result still is: 1,234.500 as if it consider dot as decimal separator. Please help! 回答1: You want to use CultureInfo: value.ToString("N",

How do I find a Unicode character's bidirectional character type in C#?

梦想与她 提交于 2019-12-10 12:57:23
问题 Is there any way I can find a Unicode character's bidirectional character type in C#? I want to look through the characters in a string and decide if they are all strong LTR, strong RTL, a mixture of strong LTR and neutral, etc. 回答1: System.Globalization.CharUnicodeInfo.GetBidiCategory(ch) is your friend. The problem is that the function is internal. This MichKap (RIP) blog post shows you how to call it using reflection. 来源: https://stackoverflow.com/questions/7255200/how-do-i-find-a-unicode

html upload: localize browse button

二次信任 提交于 2019-12-10 12:45:28
问题 How can I make the "browse" button display in another language? 回答1: The short answer is, you can't - it's controlled by the browser. The long answer is you could override it using some CSS hacks. 回答2: Browse button is a part of upload widget, and generally conforms to user's browser language settings. You could replace it altogether with some js/ajax-y thingy, but I don't see the point. 来源: https://stackoverflow.com/questions/1460731/html-upload-localize-browse-button

Floating Point Number parsing: Is there a Catch All algorithm?

别来无恙 提交于 2019-12-10 12:37:54
问题 One of the fun parts of multi-cultural programming is number formats. Americans use 10,000.50 Germans use 10.000,50 French use 10 000,50 My first approach would be to take the string, parse it backwards until I encounter a separator and use this as my decimal separator. There is an obvious flaw with that: 10.000 would be interpreted as 10. Another approach: if the string contains 2 different non-numeric characters, use the last one as the decimal separator and discard the others. If I only

iOS - Using Base localization pane is always empty

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 12:32:56
问题 In Xcode have added two localizations, German and English. I am following documentation on Apple regarding "Use Base Internationalization" which is obtained by going to the project, clicking Info and pressing on the checkbox. If I do this, it launches a pane or page which is empty. IE: How do I get it to be populated, or otherwise be in a situation to select the relevant resource file? 回答1: The answer is to localize your storyboards. Go to storyboard, there is a button called localize. If you

How to get i18next-node to display umlauts the right way?

若如初见. 提交于 2019-12-10 11:44:06
问题 I searched around quite a bit but couldn't find a solution for my problem. My app uses i18next and it works fine except for one issue: german umlauts (ü,ö,ä) are displayed as �. I don't understand were I got it wrong, since this example app has no problem with umlauts: http://i18next-example1.eu01.aws.af.cm/?setLng=de-DE (github: https://github.com/rbeere/i18next-jade-express-sample) How can I figure this one out? 回答1: The culprit might be: The Translation.json file is not saved as UTF8. If

What the negative impacts of setting ImeMode to Off

只愿长相守 提交于 2019-12-10 11:41:45
问题 I've got a Winforms application that I am in the process of translating into Chinese. I've got a numeric text box that validates the input with a regular expression. When the user is entering text with IME, numeric digits don't seem to come in as numeric digits. On possible work around I have found is to set the ImeMode property of the text box to 'Off'. In my testing, this makes everything correctly, but I don't have a ton of experiance with IMEs. What are the negative impacts of setting the

How to detect client locale in JSF application?

元气小坏坏 提交于 2019-12-10 11:33:24
问题 How can I use ServletRequest.getLocale() in JSF application, when Servlet is absent in my code and is provided by JSF implementation? I'm trying to use ServletContextListener , but is it possible to reach ServletRequest from ServletContextEvent ? Anyway, what is the correct approach? 回答1: FacesContext.getCurrentInstance().getExternalContext().getRequestLocale(); ? 回答2: The correct way in my opinion is to provide the links on your home page for various locales your application needs to support

How to use JavaScript selected functionality when particular language is selected in conjunction with ruby?

↘锁芯ラ 提交于 2019-12-10 11:29:30
问题 WHAT AM I TRYING TO ACHIEVE I have a html select box. The select box is responsible for selecting the preferred languages. for instance if a page is displayed in Germany then the select box should display Germany as its preference and likewise for the other languages. WHAT HAVE BEEN DONE SO FAR In application.html.erb I have below code #application.html.erb <select name="language" onChange="location = this.options[this.selectedIndex].value;"> <% @langs.each_pair do |short, long| %> <option