[gTrouble / libGuide] i18n? No problem.



Right. I was very kindly reminded about i18n just now by Daniel
Veillard (not a moment too soon, thanks).

libGuide will of course support i18n, and the test code does so now.

If you compile gTrouble, try running
$ ./gTrouble
and then
$ LANG="fr" ./gTrouble

(I currently only have C and fr langs in the example guide, and its
not really French, as I can't speak it, but a good demo anyway)

C is the default language for the xml tags, if none is specified using
xml:lang="lang" in the tag opener.

The code can be found currently under the gtrouble cvs module, but I
will shortly split these off into

libguide - library of guide parsing functions, capable of returning
           lots of different types of data.
gTrouble - An example prog using libGuide to display troubleshooting
           guides, using gtk widgets as an interface
gTextHelp - (A better name probably) An example console application
            using libGuide to create an interactive walkthrough on
	    the console.

The syntax for i18n is fairly easy I think, but please check it out (I
have attached the example file) to make sure I haven't missed
anything.

Feedback welcome as always...

Tom.

<------------------------------------------>

<?xml version="1.0"?>
<guide:Guide xmlns:guide="http://www.gnome.org/guide-spec-location">
  <guide:Guides>

    <guide:Guide ID="gnome-ppp-troubleshooting-mk1">
      <guide:Application>gnome-ppp</guide:Application>
      <guide:Category>Troubleshooting</guide:Category>
      <guide:Intro>Welcome to this test guide. I hope it effectively
      demonstrates my intentions (and doesn't suck)</guide:Intro>
      <guide:Intro xml:lang="fr">{fr} Bonjour. This is the intro in french</guide:Intro>
      <guide:Status>Open</guide:Status>
      <guide:Modified>Sat, 25 Sep 1999 20:27:45</guide:Modified>

<guide:Questions>
    <guide:Question ref="is_modem_connected">
        <guide:Qtext>
            Is your modem correctly connected?
        </guide:Qtext>
	<guide:Qtext xml:lang="fr">
            {fr} Is your modem correctly connected?
        </guide:Qtext>
        <guide:Choices>
	<guide:Choice value="Yes" action="Q_next">
	<guide:Choicelabel>
	Yes
	</guide:Choicelabel>
	<guide:Choicelabel xml:lang="fr">
        {fr} Oui
        </guide:Choicelabel>
	</guide:Choice>
        <guide:Choice value="No" action="goto_page" target="connect_modem">
	<guide:Choicelabel>
	No
	</guide:Choicelabel>
	<!-- Here the french trans would be the same, so we test the parser,
	it should use the 'C' translation if no native trans is available -->
	</guide:Choice>
        </guide:Choices>
        <guide:TellMe>
            Test this by examining the connections at the back of your
            modem (if it is external). This is a simple example, so that's
            as far as I go
        </guide:TellMe>
	<guide:TellMe xml:lang="fr">
	{fr} Bonjour. This is Tellme text in french...
        </guide:TellMe>
        <guide:Test lang="perl" truechoice="Yes" falsechoice="No">
            <guide:Testtext>
	    This can be tested for you if you wish...
            </guide:Testtext>
	    <guide:Testtext xml:lang="fr">
            {fr} This can be tested for you if you wish...
            </guide:Testtext>
            <guide:Testscript>
             open dev, "/dev/ttyS0" ||
             open dev, "/dev/ttyS1" ||
             return "NODE:Could not open any modem device";
            </guide:Testscript>
	    </guide:Test>
    </guide:Question>

    <guide:Question ref="modem_type">
        <guide:Qtext>
            What kind of modem is installed in your machine?
        </guide:Qtext>
	<guide:Qtext xml:lang="fr">
            {fr} What kind of modem is installed in your machine?
        </guide:Qtext>
	<guide:Choices>
        <guide:Choice value="int_isa" action="Q_next">
	<guide:Choicelabel>Internal ISA</guide:Choicelabel>
	<guide:Choicelabel xml:lang="fr">{fr} Internal ISA</guide:Choicelabel>
	</guide:Choice>
        <guide:Choice value="int_pci" action="goto_page" target="UhOh-Winmodem">
	<guide:Choicelabel>Internal PCI</guide:Choicelabel>
	<guide:Choicelabel xml:lang="fr">{fr} Internal PCI</guide:Choicelabel>
	</guide:Choice>
        <guide:Choice value="ext_ser" action="Q_next">
	<guide:Choicelabel>External Serial</guide:Choicelabel>
	<guide:Choicelabel xml:lang="fr">{fr} External Serial</guide:Choicelabel>
	</guide:Choice>
        <guide:Choice value="pcmia" action="goto_page" target="PCMIA_modem">
	<guide:Choicelabel>Internal PCMIA</guide:Choicelabel>
	<guide:Choicelabel xml:lang="fr">{fr} Internal PCMIA</guide:Choicelabel>
	</guide:Choice>
        <guide:Choice value="other" action="Q_next">
	<guide:Choicelabel>Other (or don't know)</guide:Choicelabel>
	<guide:Choicelabel xml:lang="fr">{fr} Other (or don't know)</guide:Choicelabel>
	</guide:Choice>
	</guide:Choices>
        <guide:TellMe>How to tell what type of modem you have... Blah, blah.</guide:TellMe>
        <guide:TellMe xml:lang="fr">{fr} How to tell what type of modem you have...
	Blah, blah.</guide:TellMe>
    </guide:Question>

    <guide:Question ref="pppd_installed">
        <guide:Qtext>Is pppd installed on your machine?</guide:Qtext>
        <guide:Qtext xml:lang="fr">{fr} Is pppd installed on your machine?</guide:Qtext>
	<guide:Choices>
        <guide:Choice value="yes" action="Q_next">
	<guide:Choicelabel>Yes</guide:Choicelabel>
	<guide:Choicelabel xml:lang="fr">{fr} Oui</guide:Choicelabel>
	</guide:Choice>
        <guide:Choice value="no" action="goto_page" target="install_pppd">
	<guide:Choicelabel>No</guide:Choicelabel>
	</guide:Choice>
	</guide:Choices>
        <guide:TellMe>
            Type pppd --version, and see if you get any output. If you
            have a redhat system, you can query the ppp rpm using rpm -V ppp
        </guide:TellMe>
	<guide:TellMe xml:lang="fr">
            {fr} Type pppd --version, and see if you get any output. If you
            have a redhat system, you can query the ppp rpm using rpm -V ppp
        </guide:TellMe>
        <guide:Test lang="sh" truechoice="Yes" falsechoice="No">
            <guide:Testtext>
            This can be automatically tested for you if you wish. The Test
	    will fail if you have a peculiar pppd install, but then you'd
	    probably know about it!
            </guide:Testtext>
	    <guide:Testtext xml:lang="fr">
            {fr} This can be automatically tested for you if you wish. The Test
            will fail if you have a peculiar pppd install, but then you'd
            probably know about it!
            </guide:Testtext>
	    <guide:Testscript>
	    which pppd || ls /usr/sbin/pppd || ls /sbin/pppd
	    </guide:Testscript>
        </guide:Test>
    </guide:Question>
</guide:Questions>

      <guide:Developers>
        <guide:Developer>
        <guide:Person>Miguel de Icaza</guide:Person>
        <guide:Email>miguel@gnu.org</guide:Email>
        <guide:Company>
        </guide:Company>
        <guide:Organisation>
        </guide:Organisation>
        <guide:Webpage></guide:Webpage>
        <guide:Snailmail>
        </guide:Snailmail>
        <guide:Phone>
        </guide:Phone>	
        </guide:Developer>
	
        <guide:Developer>
        <guide:Person>Elliot Lee</guide:Person>
        <guide:Email>sopwith@redhat.com</guide:Email>
        <guide:Company>
        </guide:Company>
        <guide:Organisation>
        </guide:Organisation>
        <guide:Webpage></guide:Webpage>
        <guide:Snailmail>
        </guide:Snailmail>
        <guide:Phone>
        </guide:Phone>
        </guide:Developer>
	
	<guide:Developer>
        <guide:Person>David C. Mason</guide:Person>
        <guide:Email>dcm@redhat.com</guide:Email>
        <guide:Company>
        </guide:Company>
        <guide:Organisation>
        </guide:Organisation>
        <guide:Webpage></guide:Webpage>
        <guide:Snailmail>
        </guide:Snailmail>
        <guide:Phone>
        </guide:Phone>
        </guide:Developer>	
      </guide:Developers>

      <guide:Contact>
        <guide:Person>Tom Gilbert</guide:Person>
        <guide:Email>gilbertt@tomgilbert.freeserve.co.uk</guide:Email>
        <guide:Company>
        </guide:Company>
        <guide:Organisation>
        </guide:Organisation>
        <guide:Webpage>www.tomgilbert.freeserve.co.uk</guide:Webpage>
        <guide:Snailmail>
        </guide:Snailmail>
        <guide:Phone>
        </guide:Phone>
      </guide:Contact>
      
    </guide:Guide>

  </guide:Guides>
</guide:Guide>


-- 
            .-------------------------------------------------------.
    .^.     | Tom Gilbert, England | tom@tomgilbert.freeserve.co.uk |
    /V\     |----------------------| www.tomgilbert.freeserve.co.uk |
   // \\    | Sites I recommend:   `--------------------------------|
  /(   )\   | www.freshmeat.net www.enlightenment.org www.gnome.org |
   ^^-^^    `-------------------------------------------------------'



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]