Page 1 of 1

How to localize Manna?SOLVED

Posted: Wed 12 Jun 2013, 18:44
by oldyeller
Hello Everyone,

This area is new for me, but before I continue with my Manna-Reader and Manna OS I would like to have the reader and the individual books that I made be able to be read in other languages.

I have no idea on how to use gettext so if someone could help me with this it would be appreciated.

the Manna-Reader is here http://www.murga-linux.com/puppy/viewtopic.php?t=84566

Manna OS is here http://www.murga-linux.com/puppy/viewtopic.php?t=86106

Thanks

Posted: Thu 13 Jun 2013, 20:03
by oldyeller
Hello Everyone,

I have been trying to localize Manna Editor. This is what I have got so far

Code: Select all

export MAIN_DIALOG='
<window title="'$(gettext "Manna Editor")'" icon-name="Com" resizable="false">

<frame>
<vbox spacing="0">
<menubar>
<menu use-underline="true">
<menuitem stock-id="gtk-new">
<action>launch:ADD_FILE</action>
</menuitem>
<menuitem stock-id="gtk-save">
<action>Save:EDITOR</action>
<action>Save:Saving</action>
<action>refresh:EDITOR</action>
</menuitem>
<menuitem stock-id="gtk-refresh">
<action>refresh:EDITOR</action>
</menuitem>
<menuitem stock-id="gtk-delete">
<action>launch:DEL_FILE</action>
</menuitem>
<menuitem stock-id="gtk-quit">
<action>exit:Quit</action>
</menuitem>
<label>"_File"</label>
</menu>
<menu label="'$(gettext "Edit")'">
<menuitem stock-id="gtk-edit" label="'$(gettext "Send to Abiword")'">
		<action>abiword '"$TMPDIR"'/notes &</action>
	  </menuitem>
</menu>
<menu label="'$(gettext "View")'" tooltip-text="'$(gettext " Change font size ")'">
      <menuitem '$FONTSIZE12_ICON' label="12">
		<action>echo "12" > '$WORKDIR'/font_size</action>
		<action>'$WORKDIR'/Editor &</action>
		<action type="exit">quit_now</action>
      </menuitem>
      <menuitem '$FONTSIZE14_ICON' label="14">
		<action>echo "14" > '$WORKDIR'/font_size</action>
		<action>'$WORKDIR'/Editor &</action>
		<action type="exit">quit_now</action>
      </menuitem>
      <menuitem '$FONTSIZE16_ICON' label="16">
		<action>echo "16" > '$WORKDIR'/font_size</action>
		<action>'$WORKDIR'/Editor &</action>
		<action type="exit">quit_now</action>
      </menuitem>
      <menuitem '$FONTSIZE18_ICON' label="18">
		<action>echo "18" > '$WORKDIR'/font_size</action>
		<action>'$WORKDIR'/Editor &</action>
		<action type="exit">quit_now</action>
      </menuitem>
	 </menu>
	 <menu label="'$(gettext "Help")'" >
	  <menuitem stock-id="gtk-info" label="'$(gettext "Help")'">
		<action>defaultbrowser '$WORKDIR'/editor-docs/MannaEditorHelp.html &</action>
	  </menuitem>
	  <menuitem stock-id="gtk-info" label="'$(gettext "About")'">
		<action>/tmp/Editor-help &</action>
	  </menuitem>
	 </menu>
</menubar>
</vbox>
I do have the German lang pack installed and the only thing that gets changed is the submenus under File in the menubar.

What else am I missing for the rest of the menu to change?

Posted: Fri 14 Jun 2013, 10:10
by L18L
oldyeller wrote:I do have the German lang pack installed and the only thing that gets changed is the submenus under File in the menubar.
These are in German because they are coded as gtk stock items

Code: Select all

    <menuitem stock-id="gtk-new"><action>launch:ADD_FILE</action></menuitem>
Example "New" and others see:
https://developer.gnome.org/gtk2/2.24/g ... K-NEW:CAPS
oldyeller wrote:What else am I missing for the rest of the menu to change?
You mean the "gettexted" items?
I have copied your script (named manna_editor) to /root/my-applications/bin/ (thus momanager can find it) and edited some lines.

My /root/my-applications-bin/manna_editor:

Code: Select all

#!/bin/sh
#130617 i18n started

export TEXTDOMAIN=manna_editor
export OUTPUT_CHARSET=UTF-8

export MAIN_DIALOG='
<window title="'$(gettext "Manna Editor")'" icon-name="Com" resizable="false">
<frame>
 <vbox spacing="0">
  <menubar>
  
   <menu use-underline="true" label="'$(gettext "_File")'">
    <menuitem stock-id="gtk-new"><action>launch:ADD_FILE</action></menuitem>
    <menuitem stock-id="gtk-save"><action>Save:EDITOR</action>
                                  <action>Save:Saving</action>
                                  <action>refresh:EDITOR</action>
    </menuitem>
    <menuitem stock-id="gtk-refresh"><action>refresh:EDITOR</action></menuitem>
    <menuitem stock-id="gtk-delete"><action>launch:DEL_FILE</action></menuitem>
    <menuitem stock-id="gtk-quit"><action>exit:Quit</action></menuitem>
   </menu>
   <menu use-underline="true" label="'$(gettext "_Edit")'">
    <menuitem stock-id="gtk-edit" label="'$(gettext "Send to Abiword")'"><action>abiword '"$TMPDIR"'/notes &</action></menuitem>
   </menu>

   <menu use-underline="true" label="'$(gettext "_View")'" tooltip-text="'$(gettext " Change font size ")'">
    <menuitem '$FONTSIZE12_ICON' label="12">
     <action>echo "12" > '$WORKDIR'/font_size</action>
     <action>'$WORKDIR'/Editor &</action>
     <action type="exit">quit_now</action>
    </menuitem>
    <menuitem '$FONTSIZE14_ICON' label="14">
     <action>echo "14" > '$WORKDIR'/font_size</action>
     <action>'$WORKDIR'/Editor &</action>
     <action type="exit">quit_now</action>
    </menuitem>
    <menuitem '$FONTSIZE16_ICON' label="16">
     <action>echo "16" > '$WORKDIR'/font_size</action>
     <action>'$WORKDIR'/Editor &</action>
     <action type="exit">quit_now</action>
    </menuitem>
    <menuitem '$FONTSIZE18_ICON' label="18">
     <action>echo "18" > '$WORKDIR'/font_size</action>
     <action>'$WORKDIR'/Editor &</action>
     <action type="exit">quit_now</action>
    </menuitem>
    </menu>

    <menu use-underline="true" label="'$(gettext "_Help")'" >
     <menuitem stock-id="gtk-help">
      <action>defaultbrowser '$WORKDIR'/editor-docs/MannaEditorHelp.html &</action>
     </menuitem>
     <menuitem stock-id="gtk-about" >
      <action>/tmp/Editor-help &</action>
     </menuitem>
    </menu>

   </menubar>
  </vbox>
 </frame>
</window>'
MM1RET="`gtkdialog --program=MAIN_DIALOG`"
Hope that helps :D

Posted: Fri 14 Jun 2013, 18:13
by oldyeller
Hi L18L,

Thanks now when I do the full script for Manna Editor and with MoManager will others be able to use with their language packs?

My Manna-Reader has a lot of input files how would one do those;

here is all the code for Manna-Reader. I don't want you or any one else to do this, just give me hand to get started.

Thanks

Posted: Fri 14 Jun 2013, 19:01
by L18L
Hi oldyeller
Here is how your does not run:

Code: Select all

# ./Manna-Reader
cat: /usr/local/Manna/font_size: Datei oder Verzeichnis nicht gefunden
./Manna-Reader: line 52: /usr/local/Manna/font_size: Datei oder Verzeichnis nicht gefunden
./Manna-Reader: line 59: /usr/local/Manna/gtkrc_size: Datei oder Verzeichnis nicht gefunden
cat: /usr/local/Manna/current-book: Datei oder Verzeichnis nicht gefunden
./Manna-Reader: line 149: /usr/local/Manna/current-book: Datei oder Verzeichnis nicht gefunden
cat: /usr/local/Manna/current-chapter: Datei oder Verzeichnis nicht gefunden
cat: /usr/local/Manna/chapter-selection: Datei oder Verzeichnis nicht gefunden

** (gtkdialog:3676): ERROR **: gtkdialog: Error in line 994, near token '</vbox>': syntax error

./Manna-Reader: line 1753:  3676 Trace/Breakpoint ausgelöst   $GTKDIALOG --center --program=MAIN_DIALOG
# 
Maybe it runs when the files in /usr/local exist?

Continue to use gettext
example:
change
TITLE="Book of Genesis"
to
TITLE="$(gettext 'Book of Genesis')"

and always make sure that the code can run.

That's all for now. :)

Posted: Fri 14 Jun 2013, 19:17
by oldyeller
Hi L18L,

Look at the first post it has link to the Manna-Reader.


Will keep working on it Thanks

Posted: Sat 15 Jun 2013, 01:31
by oldyeller
Hi L18L,

Manna Editor is done, now the fun starts on Manna-Reader.

How good is Google Translate?

Posted: Sun 16 Jun 2013, 11:48
by L18L
oldyeller wrote:Manna Editor is done, now the fun starts on Manna-Reader.
Usually the first translator will find something that has to be changed in the code...
So feel free to publish (or PM).
oldyeller wrote:How good is Google Translate?
Just 1 comment:
http://www.murga-linux.com/puppy/viewto ... 0&start=47 :lol:

Posted: Sun 16 Jun 2013, 15:46
by oldyeller
L18L wrote:
oldyeller wrote:Manna Editor is done, now the fun starts on Manna-Reader.
Usually the first translator will find something that has to be changed in the code...
So feel free to publish (or PM).
oldyeller wrote:How good is Google Translate?
Just 1 comment:
http://www.murga-linux.com/puppy/viewto ... 0&start=47 :lol:
I will be doing a few more languages for the Editor before uploading and posting a new pet. Will PM all language maintainers when I am done.

I can only use google translator or (m$ which I really don't want to use) :lol: :lol:

Unless there is another one out there?


Cheers