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
8
votes
1 answer

Using fgetws after setting a UTF-8 locale?

GCC 4.8, 5.1, 6.2 and Clang 3.8.1 on Ubuntu 16.10 with -std=c11, -std=c++11, -std=c++14, and -std=c++17 all exhibit this weird behaviour when using fgetws(buf, (int) bufsize, stdin) after setlocale(LC_ALL, "any_THING.utf8");. Example…
cat
  • 3,888
  • 5
  • 32
  • 61
8
votes
1 answer

Should I free the pointer returned by setlocale?

int main(int argc, char *argv[]) { char *ret = setlocale(LC_ALL, NULL); // should I free 'ret' ??? // free(ret); return 0; } I've tried both on Linux and OS X 10.10, on Linux, I must not call 'free', but on OS X, if I do not call…
noinput
  • 411
  • 3
  • 12
7
votes
2 answers

setlocale(LC_ALL, 'en_GB.UTF8') not working on windows

Why does setlocale(LC_ALL, 'en_GB.UTF8'); return false on Windows Server 2003 R2 - Zend CE PHP 5.3.5 ? Function in question: setlocale.
Marcin
  • 5,469
  • 15
  • 55
  • 69
7
votes
2 answers

Smarty "capitalize" modifier... always capitalizes "L"? ... and "P"?

Quite simply: I'm using Smarty and the |capitalize modifier. It works fine, but when I pass any word with l in it, it capitalizes it, even if it's not at the beginning of the word. What why? EDIT: Same happens with…
Lazlo
  • 8,518
  • 14
  • 77
  • 116
7
votes
1 answer

configuration.setLocale(locale) doesn't work with AppCompatDelegate.setDefaultNightMode

If I set darkmode with AppCompatDelegate.setDefaultNightMode and the system is not dark, then Configuration.setLocale doesn't work. I change the locale, for example, from En to It, all the strings are still displayed in the system language. There…
7
votes
4 answers

php - can't get date in german language

I try to display a date in German but it doesn't work. I'm using PHP with XAMPP. These are my approaches: function get_Datetime_Now() { setlocale (LC_TIME, "de_DE"); $tz_object = new DateTimeZone('Europe/Zurich'); $datetime = new…
user2871190
  • 241
  • 2
  • 5
  • 19
7
votes
1 answer

setlocale(LC_ALL, 'it_IT'); set, but still dates in english

I have this code which through json_decode retrieves my latest tweets, their date, etc. "; foreach ($twitter_data as $tweet) { if…
MultiformeIngegno
  • 6,959
  • 15
  • 60
  • 119
6
votes
1 answer

How to change string locale of notification bar in android

In my application, i'm changing language dynamically so if my is in foreground, notification language is coming properly but if i force close app notification is coming in device locale. I've used following code to change context locale but after…
6
votes
4 answers

How to format dates based on locale?

In a template I display the day and month of a specific date :
getCreatedAt())) ?>
getCreatedAt())) ?>
This works fine,…
Manu
  • 4,410
  • 6
  • 43
  • 77
6
votes
1 answer

Is it possible to disable setlocale() within a process?

We currently face the problem that an external component (we unfortunately don't know which one) that is loaded when using the Windows file open/save dialog one some systems changes the locale of the process, probably by making the call…
floele
  • 3,668
  • 4
  • 35
  • 51
5
votes
1 answer

How to Change Language in Android App without recreate Activity?

Not Able to change locale without recreating Activity An application has support of two languages, when i change the language then i must have to recreate the activity to show to desired result but i don't want to do it. private void…
Ahmad Idrees
  • 181
  • 3
  • 12
5
votes
2 answers

Python default locale (unsupported locale setting)

This seems like a weird problem, and it's causing my some heartburn, because i'm using a library that stashes the current locale, and tries to set it back to what it stashed. $ docker run --rm -it python:3.6 bash root@bcee8785c2e1:/#…
Hoopes
  • 3,943
  • 4
  • 44
  • 60
5
votes
2 answers

Why does std::locale("").name() give different results on clang and gcc?

Compiling and running the following code on my machine (MacOS 10.14.x) results in printing an empty string on clang++ and throws a runtime error on g++. Why? #include #include int main() { std::cout << "User-preferred locale…
tegtmeye
  • 132
  • 1
  • 10
5
votes
3 answers

setlocale() returns false

I have installed the dutch local (nl_NL utf8) on my webserver (when I execute locale -a I see nl_NL utf8 so this is allright). However, the dates on my webpage are in english (I have put setlocale(LC_ALL, 'nl_NL'); in the top of my pages). I have…
Arjen
  • 163
  • 2
  • 6
5
votes
1 answer

setlocale() for LC_MESSAGES to non-existing locale fails

For an embedded software project, I am adding support for translations and since we are running an embedded Linux I went for using libc gettext(). We do not have any locale definitions whatsoever installed, so I only try to set the LC_MESSAGES…
nafmo
  • 448
  • 4
  • 19
1
2
3
16 17