Would something like LC_ALL='C' be a better solution?
I assumed that English and American are the same
You're right. I can be wrong.
When I wanted to use
LC_ALL='C'
I just forgot about this and couldn't find it.
I couldn't choose the British language. The local language was always used.
I found somewhere on the internet
LANG=en_us_8859_1
and working for me.
The explanation of how it works is at the very bottom.
LC_ALL=C It is recommended by "
man sort "
*** WARNING *** The locale specified by the environment affects
sort order. Set LC_ALL=C to get the traditional sort order that
uses native byte values.
https://www.man7.org/linux/man-pages/man1/sort.1.html
Documentation is not very informative
Note: The variable LANGUAGE is ignored if the locale is set to ‘C’.
https://www.gnu.org/software/gettext/ma ... E-variable
===========================
What is C language.
When you paste in terminal command
You will see also
C and
POSIX language.
All systems provide a POSIX locale, also known as the C locale.
https://pubs.opengroup.org/onlinepubs/0 ... ocale.html
I am not sure this documentation is appropriate for Linux in this case.
Linux is UNIX based, but it can have exceptions.
The standards emerged from a project that began around 1985. Richard Stallman suggested the name POSIX to the IEEE instead of former IEEE-IX.
-->
https://en.wikipedia.org/wiki/POSIX
For C-language programs, the POSIX locale shall be the default locale when thesetlocale()function is not called.
https://1lib.pl/book/3690429/311f7f?id= ... ret=311f7f
I don't know what they mean by "
default language ".
- This could be the language on the system.
- This might be the default message used in the application.
===========================
Something interesting
In this link, she or he used
strace command to debug
The strace command allows you to see what files are loaded.
https://www.inmotionhosting.com/support ... th-lc-all/
And if you use another language,
Code: Select all
$ strace cat file.not.exist 2>&1 | grep 'write\|open'
openat(AT_FDCWD, "/etc/ld.so.preload", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "file.not.exist", O_RDONLY) = -1 ENOENT (Message about missing file in your language )
write(2, "cat: ", 5cat: ) = 5
write(2, "file.not.exist", 14file.not.exist) = 14
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/share/locale/your_language/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (Message about missing file in your language )
openat(AT_FDCWD, "/usr/share/locale-langpack/your_language/LC_MESSAGES/libc.mo", O_RDONLY) = 3
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
write(2, ": Message about missing file"..., 35: Message about missing file in your language ) = 35
write(2, "\n", 1
You will see that the "/usr/share/locale-langpack/your_language/LC_MESSAGES/libc.mo" file is loaded.
.mo files contain the text of the application in another language
https://wordpress.stackexchange.com/que ... tion-files
Example with LC_ALL=C
Code: Select all
$ LC_ALL=C strace cat file.not.exist 2>&1 | grep 'write\|open'
openat(AT_FDCWD, "/etc/ld.so.preload", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "file.not.exist", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "cat: ", 5cat: ) = 5
write(2, "file.not.exist", 14file.not.exist) = 14
write(2, ": No such file or directory", 27: No such file or directory) = 27
write(2, "\n", 1
Example with LANG=en_us_8859_1
Code: Select all
$ LC_ALL=LANG=en_us_8859_1 strace cat file.not.exist 2>&1 | grep 'write\|open'
openat(AT_FDCWD, "/etc/ld.so.preload", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/locale/LANG=en_us_8859_1/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/locale/LANG=en/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "file.not.exist", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "cat: ", 5cat: ) = 5
write(2, "file.not.exist", 14file.not.exist) = 14
write(2, ": No such file or directory", 27: No such file or directory) = 27
write(2, "\n", 1
In this example you can see that command "
cat trying find file "/usr/lib/locale/LANG=en_us_8859_1/LC_IDENTIFICATION",
but not found.
Conclusions:
If any commands will not work with LANG=en_us_8859_1
It means that not will work only for people which have this en_us_8859_1 installed.