internationalization

Regular expression that allows letters (like “ñ”) from any language

落爺英雄遲暮 提交于 2019-12-05 08:24:56
trying to let users use special characters in other languages such as Spanish or French. I originally had this: "/[^A-Za-z0-9\.\_\- ]/i" and then changed it to "/[^\p{L}\p{N}\.\_\-\(\) ]/i" but still doesn't work. letters such as "ñ" should be allowed. Thanks. Revision: I found that adding a (*UTF8) at the beginning helps solve the problem. So I'm using the following code:"/(*UTF8)[^\p{L}A-Za-z0-9._- ]/i" Revision: After looking at the answers I decided to use: "/[^\p{Xwd}. -]/u". Thanks(It works even with the Chinese alphabet. for latin languages you can use the \p{Latin} character class: /[^

Internationalization using “i18n-content” in Google Chrome

╄→гoц情女王★ 提交于 2019-12-05 08:19:33
The official documentation recommends retrieving strings for internationalization like so: document.querySelector("#appname").innerHTML = chrome.i18n.getMessage("appname"); However, the source code for the built-in pages such as the new tab page and the in-tab settings page (an example here ) use a different method which doesn't require setting up additional JavaScript commands: <title i18n-content="appname"></title> I've tried to use this in my own web applications and extensions, but I can't seem to get it to work. Can anybody shed some light on this? Is it possible to use this in web

How to achieve multilingual support in ASP.NET

こ雲淡風輕ζ 提交于 2019-12-05 08:01:01
问题 I want to internationalize my asp.net application. How to do this? What steps exactly do I have to follow? 回答1: Simply make a basepage class that will inherited from Page class, put this method in basepage class and inherit basepage class in your every aspx.cs page to acheive globalization. protected override void InitializeCulture() { Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); base.InitializeCulture(); }

How can I get and parse Accept Header to get language at JavaScript?

情到浓时终转凉″ 提交于 2019-12-05 07:44:01
How can I get and parse Accept Header to get language as two character => en, tr, ar, fr, etc. at JavaScript? EDIT: When I use navigator.language or something like that it gives me a language. However I am using a plug-in at Firefox, Quick Locale, it changes the local. When I change it from English to Arabic, still navigator.language says that I am using English. However when I connect to www.google.com, after I changed locale with Quick Locale, Google's homepage opens at Arabic language. I want to detect the user's language as like that. I will load the language properties of my HTML file

Grails: how to collect all messages

跟風遠走 提交于 2019-12-05 07:10:47
I am new to Grails and I have inherited an existing application. I have a big file message.properties that I would like to prune, in order to remove keys that are no longer used. In Django there is a command makemessages that goes through all codebase and collects all strings that need translation, adding them to the messages file and commenting out the entries that no longer exist. Is there a similar tool for Grails? If it helps, the project is based on verions 1.3.9. Mr. Cat There is no such tool, but you can create your own gant script. Take a look at getting a list of all i18n properties

Seeking source for localized Countries, Languages and Region names

荒凉一梦 提交于 2019-12-05 07:06:27
I seek a source for the world's main language names, country names, and territory names, localised into a long list of languages. Example of localised names of languages: EN EN English EN ES Inglés ES EN Spanish ES ES Español Example of localised names of a certain country in south-west Europe: ES ES España ES FR Espagne ES EN Spain Any idea where can I take/build that from? Brendan Clavin You can find the information you are looking for in the Unicode Common Locale Data Repository (CLDR) here: http://cldr.unicode.org/ Data is supplied in XML so you will need to import this into your database.

Rails I18n: Better way of interpolating links?

吃可爱长大的小学妹 提交于 2019-12-05 06:34:25
Is there a cleaner, content_tag-ish way of doing this? (I don't want HTML in my YML) en.yml: expert_security_advice: "Go <a href='{{url}}'>here</a> for expert security advice." layout.html.erb: <%= t(:expert_security_advice, :url => "http://www.getsafeonline.org") %> The best I could come up with: en.yml: expert_security_advice: "Go *[here] for expert security advice." layout.html.erb: <%= translate_with_link(:expert_security_advice, "http://www.getsafeonline.org") %> application_helper.rb: include ActionView::Helpers::TagHelper def translate_with_link(key, *urls) urls.inject(I18n.t(key)) { |s

change file encoding

社会主义新天地 提交于 2019-12-05 06:16:19
I have a problem with character encoding in some HTML pages. It seems that the cause of the problem is that some of the .html files are not saved as UTF-8 encoded files. Even though I have instructed Eclipse to save these files as UTF-8, when I open them in a browser, it indicates that the files are ISO-8859-1. How can I change the encoding of these files to UTF-8? UPDATE: I already have the following included in the section of each webpage <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> I am using the Apache web server. Thanks, Donal You may need to change the content

Collator doesn't sort right for given Locale

我与影子孤独终老i 提交于 2019-12-05 06:11:50
Here's the locale alphabet order: wikipedia Here's my code: public static void main(String[] args) { Locale loc = new Locale("sr","RS"); Collator col = Collator.getInstance(loc); col.setStrength(Collator.SECONDARY); List<String> slova = new ArrayList<String>(); slova.add("Austrija"); slova.add("Slovačka"); slova.add("Č"); slova.add("Đ"); slova.add("C"); slova.add("Grčka"); slova.add("Slovenija"); slova.add("Španija"); slova.add("Švajcarska"); slova.add("Švedska"); slova.add("Srbija"); Collections.sort(slova,col); for(String s: slova) System.out.println(s); } And here's the output: Austrija C Č

Is there a best-practice approach for internationalization of an application?

北城余情 提交于 2019-12-05 05:59:58
We need to have our apps be translated into other languages. This entails renaming the .text properties of our visible controls as well as other literals found within our apps to whatever language we need to translate into. Is this something that can easily be accomplished with .resx files? I was thinking of creating a master resx key/value list where the key would be the fully qualified name of the control/variable/constant etc. and then refactor our apps to look into this file to get their values based on the cultureinfo found at runtime? Is there a standard or simpler approach to this