Ubuntu: Setting LANG for SublimeText from Unity



Question:

I am trying to run SublimeText with the package control addon and each time I open it using the Unity launcher I receive this error.

enter image description here

So far I have tried following the instructions provided by Ubuntu Community Help, setting it in all of the mentioned places and then restarting has not fixed the problem.

I've also followed the steps found on the package control github page to no avail.

This does work when I am launching SublimeText from the command line so I am guessing it is a Unity specific problem, does anyone know how to set LANG correctly when launching SublimeText from Unity?

Edit: Adding installation details, I installed using the 64-bit SublimeText3 .deb found here, http://c758482.r82.cf2.rackcdn.com/sublime-text_build-3059_amd64.deb

Package Control was installed using the simple method found here, https://sublime.wbond.net/installation


Solution:1

I installed sublimetext using the ppa method and Package control with the "simple method" described here, it works out of the box with Ubuntu 13.10 (Unity).

To reproduce your problem I tried to force LANG-C to start sublimetext by modifying the .desktop file. I think you could try the same tweak to start it by this time forcing LANG=en_US.UTF-8:

sudo gedit /usr/share/applications/sublime-text.desktop  

And copy the following lines into the file:

[Desktop Entry]  Version=1.0  Type=Application  Name=Sublime Text  GenericName=Text Editor  Comment=Sophisticated text editor for code, markup and prose  Exec=bash -c "LANG=en_US.UTF-8 /opt/sublime_text/sublime_text %F"  Terminal=false  MimeType=text/plain;  Icon=sublime-text  Categories=TextEditor;Development;Utility;  StartupNotify=true  Actions=Window;Document;    X-Desktop-File-Install-Version=0.21    [Desktop Action Window]  Name=New Window  Exec=bash -c "LANG=en_US.UTF-8 /opt/sublime_text/sublime_text -n"  OnlyShowIn=Unity;    [Desktop Action Document]  Name=New File  Exec=bash -c "LANG=en_US.UTF-8 /opt/sublime_text/sublime_text --command new_file"  OnlyShowIn=Unity;   


Solution:2

I just had this under Ubuntu 14.04 LTS. my LANG is set system wide but sublimetext 3 package manager not picking it up.

I just did the workaround and put LANG=en_US.UTF-8 before the application path in its icon launcher.


Solution:3

I had exactly the same problem with sublimeT3. First on a terminal I ran the next command:

$echo $LOCAL  

And the output was an empty line.

Next I ran:

$locale  

An this was the output:

LANG=  LANGUAGE=en_US  LC_CTYPE=POSIX  LC_NUMERIC=POSIX  LC_TIME=POSIX  LC_COLLATE=POSIX  LC_MONETARY=POSIX  LC_MESSAGES=POSIX  LC_PAPER=POSIX  LC_NAME=POSIX  LC_ADDRESS=POSIX  LC_TELEPHONE=POSIX  LC_MEASUREMENT=POSIX  LC_IDENTIFICATION=POSIX  LC_ALL=POSIX  

I tried to reset the locales with some of the answers given here, but everything was unsuccessful, every time the "locale" command gave the same output. Even my /etc/default/locale seemed to be right:

$cat /etc/default/locale  

Output:

LANG=en_US.UTF-8  LC_NUMERIC="es_CO.UTF-8"  LC_TIME="es_CO.UTF-8"  LC_MONETARY="es_CO.UTF-8"  LC_PAPER="es_CO.UTF-8"  LC_NAME="es_CO.UTF-8"  LC_ADDRESS="es_CO.UTF-8"  LC_TELEPHONE="es_CO.UTF-8"  LC_MEASUREMENT="es_CO.UTF-8"  LC_IDENTIFICATION="es_CO.UTF-8"  

Because of this I wondered if maybe something was overriding the environment variables. My .pam_environment file seemed to be correct:

$cat .pam_environment  

Output:

LANGUAGE=en_US:en  LANG=en_US.UTF-8  LC_NUMERIC=es_CO.UTF-8  LC_TIME=es_CO.UTF-8  LC_MONETARY=es_CO.UTF-8  LC_PAPER=es_CO.UTF-8  LC_NAME=es_CO.UTF-8  LC_ADDRESS=es_CO.UTF-8  LC_TELEPHONE=es_CO.UTF-8  LC_MEASUREMENT=es_CO.UTF-8  LC_IDENTIFICATION=es_CO.UTF-8  PAPERSIZE=letter  

So I ran the next command which gave me the clue of what was going on:

$cat .bashrc | grep LANG  

Here the output:

unset LANG  

I don't know when or how, but I ended up with two lines on my .bashrc that overrode the value of "locale" variables. I'm not pasting the whole bash file, but the two key lines were these:

unset LANG  export LC_ALL=POSIX  

By commenting them on the bash file and a reboot, voila! my locale was set up as it was intended to, and sublimeT3 stopped complaining. It's been more than a year since this was formulated, but maybe it could help someone else!


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »