Saturday, January 17, 2009

How to change locale in Mozilla Firefox

... or How to change language in Mozilla Firefox ...
... or How to change the language of the Firefox menu bar
...

Purpose:
We might need to switch to a different language in Mozilla Firefox (User Interface, Spell Checker Dictionary, Website content and error messages) to test applications behavior with various internationalized testing conditions (localization or internationalization testing or automatic Globalization Support)

Description:

On Windows
We'll download any Windows specific language version from http://www.mozilla.com/en-US/firefox/all.html#languages

After installing all consecutive specific versions to the same path (every language must be downloaded and installed), we can manually change the following Mozilla Firefox variables.

Typing about:config on the address var, we can filter and change variables (with the right Windows permissions):

general.useragent.locale
intl.accept_languages
spellchecker.dictionary
extensions.qls*

Possible values:http://www.loc.gov/standards/iso639-2/php/code_list.php
(ISO 639-1 Code)

IE. (en,en-us,sv,sv-se)

Another easy and versatile way is to install Firefox Add-On "Quick Locale Switcher"
https://addons.mozilla.org/en-US/firefox/addon/1333
It allows you to quickly change and apply a different locale related setting from the tools menu, the statusbar, or your Toolbar.

After selected language and restarted Mozilla Firefox, our browser automatically goes to the right place.
ie.
en-US
http://www.mozilla-europe.org/en/
sv-SE
http://sv-se.www.mozilla.com/sv-SE/
it-IT
http://www.mozilla-europe.org/it/

On Linux
We'll download any Linux specific language version from http://www.mozilla.com/en-US/firefox/all.html#languages

We can decompress to an specific folder (one per language) and call the right one by some script and install Firefox Add-On "Quick Locale Switcher" from https://addons.mozilla.org/en-US/firefox/addon/1333

NOTE: we can also install OPIE from https://addons.mozilla.org/en-US/firefox/addon/6152 or FEBE https://addons.mozilla.org/en-US/firefox/addon/2109 to selectively backup and restore extensions if we want to try different configurations.
Or simply do backup (Firefox_Dir\defaults\profile) = file prefs.js

Links, References:
http://kb.mozillazine.org/General.useragent.locale
http://www.loc.gov/standards/iso639-2/php/code_list.php
http://wpkg.org/Firefox
https://addons.mozilla.org/en-US/firefox/addon/1333
http://kb.mozillazine.org/Firefox_:_FAQs_:_About:config_Entries

http://preferential.mozdev.org/preferences.html

Friday, January 9, 2009

Oracle bash and ksh prompt

Purpose:
Colect different bash promts to adecuate our Oracle terminal session.

Version: Unix bash/ksh

Bash prompt customization
After a user login to the system, user environment variables are initialized from various files like:

* global system files /etc/profile or /etc/bashrc
* user files ~/.bash_profile , ~/.bash_login , ~/.profile , ~/.bashrc or ~/.bash_logout.

It is important to know that all users environment variable have a life time equal to the terminal session. When the terminal session is closed the user's variables including bash shell variables defined during a terminal session are emptied and a again redefined when new terminal session is created either via logon in shell or interactive shell.

Note: Use "source" command to re-read a bash initialization .bashrc file instead of restarting a terminal session.

source .bashrc

or similarly

. .bashrc

source .bash_profile
. .bash_profile

source .profile
. .profile


Bash and ksh prompt Examples

Display current user, host, working dir, hour, Oracle versiĆ³n and SID
Working on multi-instance and different Oracle versions environments we'd need to know the working directory, ORACLE SID and other usefull data and keep the entire command line free, specially with long paths. Furthermore, we can use the promt to separate command outputs. (adapted from http://www.ludovicocaldara.net/dba/tips-bash-prompt-and-oracle)

Over bash
.bash_profile or .profile
---------------------------------------------------------------------
ohvers ()
{
echo -n $ORACLE_HOME |sed -n 's/.*\///p'
}
export PS1=$'\\n# [ \u@\h:\w [\\t] [`ohvers` SID:${ORACLE_SID:-"no sid"}] ]\\n# '

---------------------------------------------------------------------
Note: could be that way if prefered...
export PS1=$'\\n# [ $LOGNAME@\h:$PWD [\\t] [`ohvers` SID:${ORACLE_SID:-"no sid"}] ]\\n# '

output:



Display hostname, working directory and the history number of commands
We'd want to know hostname and history # of executed commands.

Over ksh
.profile
---------------------------------------------------------------------
export PS1="`uname -n`$[!]$ "---------------------------------------------------------------------
output:
tauro$[8]$

W/working directory
---------------------------------------------------------------------
export PS1=`uname -n`@`whoami`':$PWD [!] $'
---------------------------------------------------------------------
output:
tauro@oracle:/oracle [2] $

Over bash
.bash_profile
---------------------------------------------------------------------
export PS1=`uname -n`@`whoami`':$PWD [\!] $'
---------------------------------------------------------------------
output:
tauro@oracle:/oracle/product/10.2.0/bin [824] $

Counting Files in the Current Directory
This bash prompt displays current number of files and directories in the current directory.

---------------------------------------------------------------------
export PS1="\u@\h [\$(ls | wc -l)]:\$ "
---------------------------------------------------------------------
output:
oracle@tauro [334]:$ pwd
/oracle/product/10.2.0/bin
oracle@tauro [334]:$

Links, References:
http://www.linuxconfig.org/Bash_prompt_basics
Unix man pages: bash/ksh
http://www.ludovicocaldara.net/dba/tips-bash-prompt-and-oracle

Oracle Search