LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Can't get Bulgarian locale to work properly (http://www.linuxquestions.org/questions/slackware-14/cant-get-bulgarian-locale-to-work-properly-4175434751/)

Jotto 10-30-2012 09:22 AM

Can't get Bulgarian locale to work properly
 
Hello.

It seems that i can't get my locale to work properly. When i try to browse my home folder or external hdd (in my case) with dolphin, konqueror, thunar or just a simple shell i get strange symbols like ??????? or Свалени. This is all on Slackware64-14 full install.

So i've done some reading and figured out that i have to change my settings in /etc/profile.d/lang.sh to export LANG=bg_BG and left everything else as-is.
The strange symbols disappeared and everything worked fine, but then logged as root i tried to install some packages with pkgtool and pkgtool's menu looked strange. Then i tried export LANG=bg_BG.UTF-8, pkgtool looked fine, but when i tried some text editing in terminal with nano it's menu's were also with strange symbols.

I really want to learn and solve problems, but particularly this one i can't understand... yet :)

Thanks in advice for your help.

knudfl 10-30-2012 10:20 AM

Welcome to LQ.

The keybord settings must be applied in KDE :
Menu : Configure Your Desktop
( Or : $ systemsettings )
> Hardware > Input Devices >> Keyboard : Layouts >> Configure Layouts,
.. and then add Bulgarian, and remove "the other <country>".

Now everything you type, should be 'Bulgarian'.
*** The settings must be applied in the "user KDE",
and also "root KDE" ( if you ever want to login as root.)

.

Jotto 10-30-2012 10:37 AM

I can type in Bulgarian - пример. My problem is not about keyboard layouts. I can't configure my system to display properly cyrillic+latin characters. I set export LANG=bg_BG in "/etc/profile.d/lang.sh" and dolphin, konkueror, thunar and bash work fine. Folder names written in bulgarian are displayed properly, but then some applications like pkgtool and nano don't display fine (haven't tried other programs).

Didier Spaier 10-30-2012 04:00 PM

Try 'export LANG=bg_BG.utf8' instead.

Totoro-kun 10-30-2012 04:01 PM

Good evening fellow slacker,
Recently I have been working with Slackware localization for Lithuanian language. So I can share what I've learned and hopefully this will be more or less useful to you.

First, if you are doing localization stuff, there is good chance that you want to use UTF-8 locales, if you do, then you need 4 things:
1. append=" vt.default_utf8=1" line in lilo.conf file
2. edit /etc/profile.d/lang.sh and /etc/profile.d/lang.csh files to set system-wide locale
3. install good Unicode font, like terminus-font from SBo
4. edit your ~/.bashrc and/or ~/.bash_profile files to enable font and source /etc/profile

Usually there are two scenarios with localization:
1. Localize whole system. (set bg_BG system-wide)
2. Per user localization (leave en_US system-wide, set bg_BG for you)

Now this is what I do for system-wide localization:
1. Edit /etc/lilo.conf and add utf-8 append if it isn't there:
Code:

# Append any additional kernel parameters:
append=" vt.default_utf8=1"
boot = /dev/sda
compact

Then issue lilo command to update boot loader. If you needed to do this step, then you will need to reboot after all below steps are done.
2. Edit /etc/profile.d/lang.sh and /etc/profile.d/lang.csh to set needed locale:
Code:

#/etc/profile.d/lang.sh
#export LANG=en_US.ISO8859-1
export LANG=lt_LT.UTF-8

and:
Code:

#/etc/profile.d/lang.sh
#export LANG=en_US.ISO8859-1
export LANG=lt_LT.UTF-8

3. Install Terminus-font from slackbuilds.org
4. Edit ~/.bash_profile
Code:

#~/.bash_profile
# Source global definitions
if [ -f /etc/profile ]; then
    . /etc/profile
fi
# Set Terminus font
if [ $TERM = "linux" ]; then
    setfont ter-v16n
fi

Then edit ~/.bashrc and add:
Code:

# Source global definitions
if [ -f /etc/profile ]; then
    . /etc/profile
fi
# Set Terminus font
if [ $TERM = "linux" ]; then
    setfont ter-v16n
fi

Thats it. After this I have Slackware speaking Lithuanian in command line and in GUI system-wide. However, I hear it's advised (not sure why) to leave system-wide setting to non-Unicode en_US locale and only enable Unicode locales for users who needs them. In this scenario I do similar steps, but slightly different. First 3 steps are identical, you just need to leave lang.sh and lang.csh set to en_US or en_US.UTF-8 and then edit your ~/.bashrc and/or ~/.bash_profile files to set user locale:
Code:

#~/.bash_profile
# Source global definitions
if [ -f /etc/profile ]; then
    . /etc/profile
fi
export LANG=lt_LT.UTF-8
if echo $LANG | grep -iq UTF ; then
  export G_FILENAME_ENCODING="@locale"
fi
# Set Terminus font
if [ $TERM = "linux" ]; then
    setfont ter-v16n
fi

and:
Code:

#~/.bashrc
# Source global definitions
if [ -f ~/.bash_profile ]; then
    . ~/.bash_profile
fi

Hope this helps. But do keep in mind that this is just how I do it and I am not 100% sure on .bash part (maybe someone can explain more clearly), but both scenarios works well for me so far.

Didier Spaier 10-30-2012 04:14 PM

Quote:

Originally Posted by Totoro-kun (Post 4818458)
However, I hear it's advised (not sure why) to leave system-wide setting to non-Unicode en_US locale and only enable Unicode locales for users who needs them.

Probably you were told that by the 'liloconfig' script:
Code:

ask_utf() {
 dialog --defaultno --title "USE UTF-8 TEXT CONSOLE?" --yesno \
"Beginning with the 2.6.24 kernel, the text consoles default to UTF-8 mode.  \
Unless you are using a UTF-8 locale (\$LANG setting), using the old default \
of a non-UTF text console is safer until some issues with various console \
programs are addressed.  This option has no effect on the use of UTF-8 with X.  \
\"No\" is the safe choice here." 10 70
}

But as you are using an UTF-8 locale there is no problem in your case. Same for me, I set LANG to fr_FR.utf8 and am very happy with this setting.

In fact I can't think of a really good reason nowadays not to use UTF-8. I would even advise people whose US English is the native (and maybe the sole) language to set LANG to en_US.utf8. It won't hurt ;)

PS Please someone correct me if I am wrong. If there are any caveat or inconvenience to do that I would be pleased to hear about it, so I will learn one more thing.

PS2 I am myself studying the feasibility of localizing at least Slackware's installer so maybe we could share ideas? I will open a new thread on that topic.

Didier Spaier 10-30-2012 05:08 PM

Following my previous post, see here.

Jotto 10-30-2012 05:25 PM

Everything works like a swiss clock. Thank you.

I updated /etc/lilo.cfg with the options mentioned, /etc/profile.d/lang.sh from "export LANG=en_US" to "export LANG=bg_BG.UTF-8" and /etc/profile.d/lang.csh from "setenv LANG en_US" to "setenv LANG bg_BG.UTF-8".
I noticed that after the restart my menus changed to bulgarian (translated from english) since i use KDE and i have KDE international support package installed. So from this i came to conclusion that my problem might be caused by lang.csh's setenv bg_BG.UTF-8. I am not sure but i think last time i tried to change these settings i had no success, but now when i think back i think that i had no kde international support installed. I don't know if this caused my problem, but i'm happy that everything works now, thanks again. :)

The idea for better explanation about locales is good.

EDIT: I forgot to mention that i didn't install the font and everything still worked. I haven't tried the per user method, but i will. Strange thing is that i don't have these files in my home folder ( i know they are hidden :D ), should i created them?

Totoro-kun 10-31-2012 01:35 AM

Good morning,
I'm glad that you made it work.

As for .bashrc and .bash_profile, they are not included in Slackware by default and I guess not really needed for a system-wide localization as system will source /etc/profile anyway, however they are very useful if you want to customize your command prompt and bash environment, so you might want to investigate them further if you use terminal a lot. For per user localization, it is enough to create ~/.profile file:
Code:

export LANG=lt_LT.UTF-8
if echo $LANG | grep -iq UTF ; then
  export G_FILENAME_ENCODING="@locale"
fi

Since I am using .bashrc and .bash_profile files, I find I do not need .profile file.

It seems, that the font part depends on language, since I had some troubles displaying Lithuanian letters in file system untill I installed this font.


All times are GMT -5. The time now is 05:17 AM.