Questions tagged [setlocale]

The setlocale() is a function that is used to configure and specify certain locale information.

The setlocale() is a function that is used to configure and specify certain locale category information. Such locale categories can be:

  • LC_ALL
  • LC_COLLATE
  • LC_CTYPE
  • LC_MONETARY
  • LC_NUMERIC
  • LC_TIME
  • LC_MESSAGES

Additionally, the locale must be specified. The locale is actually the universal locale code of the currently language.

The possible locale and category values are specified in RFC 1766 and ISO 639.

249 questions
5
votes
2 answers

Configure Dutch format for date in Laravel

In my Laravel application in want to display a date in Dutch format. In my config/app.php file I have my timezone and locale both set: 'timezone' => 'Europe/Amsterdam', 'locale' => 'nl', But if I print a date in my blade file like…
kipzes
  • 694
  • 2
  • 10
  • 27
5
votes
3 answers

PHP: date "F" with setlocale not working

5
votes
1 answer

setlocale in Mac OS X doesn't work

I'm working on cross-platform C++ application. It is multilingual and have to show all messages in usera language. In order to detect locale i'm using setlocale(LC_ALL, "") call. It returns current language and country, for example "ru_RU.UTF-8"…
5
votes
3 answers

setlocale php function returns false even if the locale is available in the platform

I am working on a cloud platform and the server is Apache. In one of the site instances,the php script setlocale(LC_ALL, "en_GB.utf8"); always returns false. This locale,"en_GB.utf8" can be found available in the platform when I execute locale…
Reji Nair
  • 51
  • 1
  • 3
5
votes
4 answers

wstring::find() doesn't work with non-latin symbols?

I have an wide-character string (std::wstring) in my code, and I need to search wide character in it. I use find() function for it: wcin >> str; wcout << ((str.find(L'ф') != wstring::npos)? L"EXIST":L"NONE"); L'ф' is a Cyrillic letter. But…
shau-kote
  • 1,110
  • 3
  • 12
  • 24
4
votes
3 answers

toLowerCase() method in Java when used with Locale does not produce the exact result

Look at the following code snippet in Java. final public class Main { public static void main(String[] args) { Locale.setDefault(new Locale("lt")); String str = "\u00cc"; //setting Lithuanian as locale …
Lion
  • 18,729
  • 22
  • 80
  • 110
4
votes
1 answer

PHP iconv greek/cyrillic transliteration does not work

i have the following test code: setlocale(LC_ALL, 'en_US.UTF8'); function t($text) { echo "$text\n"; echo "encoding: ", mb_detect_encoding($text), "\n"; // transliterate $text = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $text); …
Ernests Karlsons
  • 2,220
  • 5
  • 25
  • 37
4
votes
3 answers

setlocale() not working on localhost using MAMP on MacOS

My problem in short: I am using setlocale(LC_TIME, "de_DE") in order to display the "verbal" parts of a date/time (i.e. month, weekday) in German. This works on any public server, but doesn't on my localhost, using MAMP, which displays it in English…
Johannes
  • 64,305
  • 18
  • 73
  • 130
4
votes
1 answer

Multiple calls to setlocale

I am trying to figure out how Unicode is supported in C++. When I want to output multilingual text to console, I call std::setlocale. However I noticed that the result depends on prior calls to setlocale. Consider the following example. If run…
Dima Chubarov
  • 16,199
  • 6
  • 40
  • 76
4
votes
1 answer

Why does LC_ALL setlocale setting affect cout output in Powershell?

I'm trying to understand some behavior I'm seeing. I have this C++ program: // Outputter.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include int main() { // UTF-8 bytes for "日本語" std::cout…
Aurast
  • 3,189
  • 15
  • 24
4
votes
3 answers

How to change locale in python in windows?

I want to format price in integer to properly formatted currency. Example 10000 to or ₹10,000 So, I am using the following commands in python import locale locale.setlocale(locale.LC_MONETARY, 'en_US') or locale.setlocale(locale.LC_MONETARY,…
Avtar Singh
  • 261
  • 8
  • 14
4
votes
2 answers

PHP setlocale, UTF-8 or not?

I've installed zh_TW locale via sudo locale-gen --purge en_US.UTF-8 zh_TW And it codeset is BIG5 locale: zh_TW directory: /usr/lib/locale/zh_TW ------------------------------------------------------------------------------- title |…
Howard
  • 19,215
  • 35
  • 112
  • 184
4
votes
2 answers

Accepting international numbers with decimal and thousands separator in PHP

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…
Paul
  • 8,974
  • 3
  • 28
  • 48
3
votes
2 answers

Gettext and PHP 5.3.5 xampp - Use of undefined constant LC_MESSAGES - assumed 'LC_MESSAGES' in

I am getting the following error: Notice: Use of undefined constant LC_MESSAGES - assumed 'LC_MESSAGES' in C:\Program Files\xampp\htdocs\xampp\phptest\resources\testi18n.php on line 19 Notice: Undefined index: language in C:\Program…
yby
  • 31
  • 1
  • 2
3
votes
2 answers

Printing Japanese characters in C program

I want to print Japanese characters using the C program. I've found the Unicode range of some Japanese characters, converted them to decimal and used the for loop to print them: setlocale(LC_ALL, "ja_JP.UTF8"); for (int i = 12784; i <= 12799; i++)…
1 2
3
16 17