How to localize Manna?SOLVED

For efforts in internationalising Puppy and solving problems in this area
Post Reply
Message
Author
User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

How to localize Manna?SOLVED

#1 Post 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
Last edited by oldyeller on Mon 17 Jun 2013, 08:40, edited 1 time in total.

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#2 Post 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?

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

#3 Post 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
Attachments
manna1.png
before
(8.58 KiB) Downloaded 301 times
create_manna_editor.mo.png
momanager
(8.93 KiB) Downloaded 276 times
manna_de.png
Menu translated using momanager
(7.18 KiB) Downloaded 286 times

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#4 Post 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
Attachments
Manna-Reader.gz
(99.76 KiB) Downloaded 451 times

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

#5 Post 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. :)

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#6 Post by oldyeller »

Hi L18L,

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


Will keep working on it Thanks

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#7 Post by oldyeller »

Hi L18L,

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

How good is Google Translate?

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

#8 Post 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:

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#9 Post 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

Post Reply