localization

Which Locale should I specify when I call String#toLowerCase?

岁酱吖の 提交于 2020-05-25 09:30:05
问题 In Java the String#toLowerCase method uses the default system Locale to determine how to handle lowercasing. If I am lowercasing some ASCII text and want to be sure that this is processed as expected which Locale should I use? EDIT: I'm mainly concerned about programming identifiers such as table and column names in a schema. As such I want English lower casing to apply. Locale.ROOT states that it is the language/country neutral locale for the locale sensitive operations Locale.ENGLISH would

DateTimeFormatter Cannot Parse Dates Without Leading Zeroes in German

五迷三道 提交于 2020-05-08 16:12:06
问题 Our client found an interesting bug today. Consider the following method: final DateTimeFormatter englishFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withLocale(Locale.ENGLISH); System.out.println(LocalDate.parse("04/01/17", englishFormatter)); System.out.println(LocalDate.parse("4/1/17", englishFormatter)); final DateTimeFormatter germanFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withLocale(Locale.GERMAN); System.out.println(LocalDate.parse("01.04.17"

DateTimeFormatter Cannot Parse Dates Without Leading Zeroes in German

瘦欲@ 提交于 2020-05-08 16:11:23
问题 Our client found an interesting bug today. Consider the following method: final DateTimeFormatter englishFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withLocale(Locale.ENGLISH); System.out.println(LocalDate.parse("04/01/17", englishFormatter)); System.out.println(LocalDate.parse("4/1/17", englishFormatter)); final DateTimeFormatter germanFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withLocale(Locale.GERMAN); System.out.println(LocalDate.parse("01.04.17"

DateTimeFormatter Cannot Parse Dates Without Leading Zeroes in German

对着背影说爱祢 提交于 2020-05-08 16:11:14
问题 Our client found an interesting bug today. Consider the following method: final DateTimeFormatter englishFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withLocale(Locale.ENGLISH); System.out.println(LocalDate.parse("04/01/17", englishFormatter)); System.out.println(LocalDate.parse("4/1/17", englishFormatter)); final DateTimeFormatter germanFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withLocale(Locale.GERMAN); System.out.println(LocalDate.parse("01.04.17"

DateTimeFormatter Cannot Parse Dates Without Leading Zeroes in German

给你一囗甜甜゛ 提交于 2020-05-08 16:10:32
问题 Our client found an interesting bug today. Consider the following method: final DateTimeFormatter englishFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withLocale(Locale.ENGLISH); System.out.println(LocalDate.parse("04/01/17", englishFormatter)); System.out.println(LocalDate.parse("4/1/17", englishFormatter)); final DateTimeFormatter germanFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withLocale(Locale.GERMAN); System.out.println(LocalDate.parse("01.04.17"

Java: How to display weekday, month and date and no year in locale sensitive manner

眉间皱痕 提交于 2020-05-08 15:42:09
问题 In my app I need to display dates in a locale-sensitive manner. So "Thursday, May 10, 2018" should display as is in en_US but should display as "Thursday, 10 May 2018" in en_GB (English Great Britain). In most cases I can use the following style of code with java.time API classes: public String toString(ZonedDateTime input) { DateTimeFormatter dateTimeFormatter = getDateTimeFormatter(FormatStyle.MEDIUM, FormatStyle.SHORT); return input.format(dateTimeFormatter); } private DateTimeFormatter

Get localized month name using native JS

蹲街弑〆低调 提交于 2020-05-08 06:56:51
问题 It's possible to do this to get the localized full month name using native javascript. var objDate = new Date("10/11/2009"), locale = "en-us", month = objDate.toLocaleString(locale, { month: "long" }); But this only gets the month number for a given date. I'd simply like to get the month name corresponding to a month number. For example, if I do getMonth(2) it would return February . How can I implement getMonth using native javascript(no libraries like moment )? 回答1: You are already close:

Get localized month name using native JS

守給你的承諾、 提交于 2020-05-08 06:56:48
问题 It's possible to do this to get the localized full month name using native javascript. var objDate = new Date("10/11/2009"), locale = "en-us", month = objDate.toLocaleString(locale, { month: "long" }); But this only gets the month number for a given date. I'd simply like to get the month name corresponding to a month number. For example, if I do getMonth(2) it would return February . How can I implement getMonth using native javascript(no libraries like moment )? 回答1: You are already close:

apply translation using gettext .po files

时光毁灭记忆、已成空白 提交于 2020-04-30 05:44:13
问题 Okay, this should be simple, but I can't find the information I need. Let's say I created .po file from some text file (which is not a source code). I translated needed strings. How do I apply this .po file? In other words what software should I use to replace strings in a given text file based on the existing .po file? I expect this to be a commandline utility or gui-based that can do this in a batch for hundreds of files. Edit: oh, forgot one important thing. This is for Windows! 回答1: polib

Laravel localization to German and special letters

折月煮酒 提交于 2020-04-17 15:14:24
问题 I have a problem with some German's special letters (ö, ü...) in my Laravel application. My encoding is set to UTF-8. Everything works fine with the content from the database (where is utf8_general_ci ). When I hardcode some text to Blade view files, that's fine, too. But, I'm using localization files ( /app/lang/de/myFile.php ) with an associative array. German characters from that array are displayed as � � �. What is strange, when I var_dump(trans('myFile.key')) in Blade, special