Using just GNU gettext is working in shell.CoronelN wrote:the ideal would be to replace them all with a VAR and call it in from your code but i dont know how efficient that will be as i understand that bash even thou powerful is not a complete programming enviroment and maybe it will be too long a code + constant VAR calling etc...
see screenshot for Afrikaans and Française.
Code: Select all
#!/bin/bash
#PupShutdown 1.6
#Copyright 2011 GPL3
#Roger Grider (radky)
# i18n L18L
export TEXTDOMAIN=pupshutdown
.
.
.
#ENVIRONMENT_LANG=`echo $LANG | sed "s/\(..\).*/\1/"` ##detect language
#case $ENVIRONMENT_LANG in
#af) PUP_POWEROFF="Power-Off "
# PUP_REBOOT=" Herlaai "
# PUP_PROMPT="Aan Prompt "
# PUP_LOCK=" Skermsluit "
# PUP_RESTART="Herbegin X "
# PUP_RESTARTWM="Herbegin WM "
# PUP_TASK="Beheer Taak "
# PUP_BACKUP=" Backup Files " ;;
#*) PUP_POWEROFF=" Power-Off "
# PUP_REBOOT=" Reboot "
# PUP_PROMPT=" Log-Out "
# PUP_LOCK="Lock Screen "
# PUP_RESTART=" Restart X "
# PUP_RESTARTWM=" Restart WM "
# PUP_TASK="Manage Task "
# PUP_BACKUP=" Backup Files " ;;
#esac
PUP_POWEROFF=$(gettext " Power-Off ")
PUP_REBOOT=$(gettext " Reboot ")
PUP_PROMPT=$(gettext " Log-Out ")
PUP_LOCK=$(gettext "Lock Screen ")
PUP_RESTART=$(gettext " Restart X ")
PUP_RESTARTWM=$(gettext " Restart WM ")
PUP_TASK=$(gettext "Manage Task ")
PUP_BACKUP=$(gettext " Backup Files ")
#About dlg...
.
Code: Select all
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PupShutdown 1.6\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-06-21 17:26+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: PupShutdown:85
#, sh-format
msgid " Power-Off "
msgstr ""
#: PupShutdown:86
#, sh-format
msgid " Reboot "
msgstr ""
#: PupShutdown:87
#, sh-format
msgid " Log-Out "
msgstr ""
#: PupShutdown:88
#, sh-format
msgid "Lock Screen "
msgstr ""
#: PupShutdown:89
#, sh-format
msgid " Restart X "
msgstr ""
#: PupShutdown:90
#, sh-format
msgid " Restart WM "
msgstr ""
#: PupShutdown:91
#, sh-format
msgid "Manage Task "
msgstr ""
#: PupShutdown:92
#, sh-format
msgid " Backup Files "
msgstr ""
Code: Select all
msginit --locale=es
Code: Select all
geany es.po
fill msgstr with Spanish translation and then
Code: Select all
msgfmt es.po -o - > /usr/share/locale/es/LC_MESSAGES/pupshutdown.mo
Start in Spanish:
Code: Select all
LANGUAGE=es /usr/local/PupShutdown/PupShutdown