setlocale

How to format dates based on locale?

大兔子大兔子 提交于 2019-12-22 06:03:24
问题 In a template I display the day and month of a specific date : <div class="jour"><?php echo date('d',strtotime($content->getCreatedAt())) ?></div> <div class="mois"><?php echo date('M',strtotime($content->getCreatedAt())) ?></div> This works fine, problem is the month name is in English. Where do I specify that I want the month names in another locale, French for instance ? 回答1: Symfony has a format_date helper among the Date helpers that is i18n-aware. The formats are unfortunately badly

How to get application language and device language separately in android?

断了今生、忘了曾经 提交于 2019-12-20 10:24:28
问题 My device language is in English and my application language is in Italian.So how I get the device language and application language programmatically ? 回答1: get system language Resources.getSystem().getConfiguration().locale.getLanguage(); get app language String CurrentLang = Locale.getDefault().getLanguage(); 回答2: This is the correct answer: getResources().getConfiguration().locale 回答3: To Get System Language Use this: String DeviceLang =Resources.getSystem().getConfiguration().locale

How to debug gettext not working in PHP?

大憨熊 提交于 2019-12-18 03:14:05
问题 i am trying to use the php gettext extension in php 5.5 (on win2008 server, using IIS7). I am doing this: <?php $locale = "es"; if (isSet($_GET["locale"])) $locale = $_GET["locale"]; putenv("LC_ALL=$locale"); setlocale(LC_ALL, $locale); bindtextdomain("messages", "./locale"); textdomain("messages"); echo gettext("Hello world"); ?> With this folder structure in place: locale/es/LC_MESSAGES/messages.mo But it always just returns Hello world and not the correct translation which for now (based

Issue with Laravel 5.2 and His non-persistent App SetLocale over http://

痞子三分冷 提交于 2019-12-13 08:09:46
问题 Can anyone point me in the right direction when trying to troubleshoot this web app (Dorothea Special School) I created a few years back using this link Laravel 5 And His F*cking non-persistent App SetLocale If I can recall it was working perfectly when I 1st published the web app, but for a while now it doesn't seem to be working correctly... I think I did check the log file on the server and a couple more things to no avail. Do you think I need to run a composer cmd on the server? 回答1: You

How to use setlocale function in php to get month name in french?

风格不统一 提交于 2019-12-11 17:19:08
问题 I am working on a php code $formated_date_new = date('M d, Y',strtotime($this_date)); which gives me the month name in english. <script> document.getElementById('title_en').value = "<?php echo $formated_date_new ?>"; </script> The above script returns the date in the following format (with month name in english) : Mar 13, 2019 For getting the month name in french, I need to integrate the following code but I am not sure how to do it. <?php setlocale(LC_TIME, "fr_FR"); echo strftime(" in

How to add Norwegian to setlocale()?

拈花ヽ惹草 提交于 2019-12-11 05:48:47
问题 I want to add Norwegian date. So that I can have two languages on my website. According to PHP manual, it says that The return value of setlocale() depends on the system that PHP is running. It returns exactly what the system setlocale function returns. How can I add Norwegian ? Thanks in advance. I want to use setlocale(), and strftime() as followings. (for Norwegian and English) setlocale(LC_TIME, "C"); echo strftime("%A"); setlocale(LC_TIME, "fi_FI"); echo strftime(" in Finnish is %A,");

How to change date time format on a localized website?

喜你入骨 提交于 2019-12-11 05:43:01
问题 I have a localized website for different languages Users can select which language to use in a profile and this will be applied beforePageLoad using context.setLocalString("en") "en" is default to en-US i believe so the dates on the website is displayed in the US format so I learned that I can use instead. context.setLocale(new Locale("en","gb")) the problem with setLocal is that is does not update the HTML lang="en" attribute so event though the dates are correct after using setLocal the

Accepting international numbers with decimal and thousands separator in PHP

风流意气都作罢 提交于 2019-12-11 03:29:18
问题 For an online calculator where users may enter an energy amount to calculate corresponding fees, I need the PHP script to accept various user inputs. The value of "2 million and one fourth joule" may be entered as: 2000000.25 (default notation) 2,000,000.25 (with thousands separator) 2000000,25 (comma as decimal point) 2.000.000,25 (comma as decimal point, with thousands separator) 2'000'000.25 (alternative format) 2 000 000,25 (French notation) How could I make the script aware of such

Android SQLiteDiskIOException in getReadableDatabase(), native_setLocale, SQLiteOpenHelper

感情迁移 提交于 2019-12-11 03:06:51
问题 Recently I've run into a problem connected with using SQLiteOpenHelper. Few users reported the error I can't reproduce: android.database.sqlite.SQLiteDiskIOException: disk I/O error at android.database.sqlite.SQLiteDatabase.native_setLocale(Native Method) at android.database.sqlite.SQLiteDatabase.setLocale(SQLiteDatabase.java:1987) at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1855) at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:820) at

Table of conversion of ISO-639/ISO-3166 based language/country locale name to Windows ones and back

我的未来我决定 提交于 2019-12-08 08:26:47
问题 I want to convert POSIX locale names like en_US , de_DE that use ISO-639-1 and ISO-3166 codes to Windows ones English_United States , German_Germany and back. I had found following tables on MSDN site: Languages http://msdn.microsoft.com/en-us/library/39cwe7zf(v=VS.71).aspx Countries http://msdn.microsoft.com/en-us/library/cdax410z(v=VS.71).aspx However they are very partial. For example these tables miss Arabic, Hebrew and many other locales that I know are supported Hebrew_Israel . Where