All of lore.kernel.org
 help / color / mirror / Atom feed
* gettext
@ 2007-05-19 10:21 Robert Millan
  2007-05-19 17:30 ` gettext Yoshinori K. Okuji
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Millan @ 2007-05-19 10:21 UTC (permalink / raw)
  To: grub-devel


Are there any plans to implement gettext ?  If not, I'd like to send a
proposal.

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.



^ permalink raw reply	[flat|nested] 6+ messages in thread
* gettext
@ 2009-01-13 22:11 Carles Pina i Estany
  2009-01-14 22:43 ` gettext Carles Pina i Estany
  0 siblings, 1 reply; 6+ messages in thread
From: Carles Pina i Estany @ 2009-01-13 22:11 UTC (permalink / raw)
  To: grub-devel


Hello,

I was thinking to implement some kind of internalization in Grub2. We
discussed some months ago, but now I have been playing with something
and thinking a bit more how to do it.

I have done a "draft" program (working, not shareable -needs some
clenaup-, in standalone C) that getting a .mo file and string translates
the string.

I've based my implementation on:
http://www.gnu.org/software/autoconf/manual/gettext/MO-Files.html
(the basic one is about 200 lines)

I'm not using the gettext hash table so I safe some space (in the .mo
files and code), and Grub doesn't have so much strings to need the hash.
Also, I'm using bisection to search a bit faster. I'm using msgmft
--no-hash to not include the hash in the .mo file.

* SCRIPTS (userland)
We could add gettext support using external gettext program like I
commented here:
http://lists.gnu.org/archive/html/grub-devel/2008-12/msg00030.html

or we could use the Grub2 "gettext mo reader" program (already
implemented the basic version): so we would be testing our mo reader
even in userland, and have one less dependency: gettext binary (in
Debian it comes with gettext-base package).

Which are your thoughts for it?

* GRUB2
My idea is to create in Grub2 a function called _("..."). This function
will exist in standard Grub2 and return the same string that it's
passed.

Then I would implement a module that overwrites this function and does
something like:
a) get Grub2 language variable (to decide the language)
b) open the language file and search for the string that the function
received
c) return the translation (or same string if could not be find)

Thing to maybe improve:
not open the .mo file everytime and read a couple of headers (just a few
fseek and fread, actually) and do it only when the variable is changed.
So I would need a hook to reopen the .mo file and load some .mo file
information when the user changes the variable or perhaps check the
previous variable value with the current one and reopen the file if it's
different.

Would someone do it in a different way? Which way?

Thanks,

-- 
Carles Pina i Estany		GPG id: 0x17756391
	http://pinux.info



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-01-14 22:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-19 10:21 gettext Robert Millan
2007-05-19 17:30 ` gettext Yoshinori K. Okuji
2007-05-20  7:34   ` gettext Robert Millan
2007-05-20  8:09     ` gettext Vesa Jääskeläinen
  -- strict thread matches above, loose matches on Subject: below --
2009-01-13 22:11 gettext Carles Pina i Estany
2009-01-14 22:43 ` gettext Carles Pina i Estany

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.