From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LsPVv-00006P-Te for mharc-grub-devel@gnu.org; Fri, 10 Apr 2009 18:47:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LsPVu-0008WT-5t for grub-devel@gnu.org; Fri, 10 Apr 2009 18:47:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LsPVp-0008Rb-Ic for grub-devel@gnu.org; Fri, 10 Apr 2009 18:47:57 -0400 Received: from [199.232.76.173] (port=35069 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LsPVp-0008RO-Cv for grub-devel@gnu.org; Fri, 10 Apr 2009 18:47:53 -0400 Received: from mail-fx0-f166.google.com ([209.85.220.166]:52216) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LsPVo-00048b-PI for grub-devel@gnu.org; Fri, 10 Apr 2009 18:47:53 -0400 Received: by fxm10 with SMTP id 10so1353751fxm.42 for ; Fri, 10 Apr 2009 15:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=iKIP+wAbtvIWpQzmqQIlpH3g7rwAo/RoA7HaLWuBxWE=; b=XOcJciegtdfhbOIjUW7kzr1eOw/52jiy/UXqSjf9C3bRbEd5cyseVcfwgNHssnSDqy iEHAsAB5BYdJR26I6XoE8hhsLUx/qOq3ki49QXjPtmto2WirlPVXyo6MrCI/doCXjlrh yW/k+o/2no2h50iU2e48AUEeKtS0N/wssay7A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=sqMjGPNOGA/Hj19E0dRzSgC5WXCS1IZ/Jg9rCqpCYxX/8frfmYNbp17KkyAqB2I/f9 kWK/PUp9LPu68Th/BwHxgWHjy4mSO1vf2EWw8X9axe+4V0F0jGMDe8QnHwnuWwy3CRX+ 4HgP6yJ/LqXvwqZ8GsnglkCukRF2VTP3aMH6c= Received: by 10.86.90.2 with SMTP id n2mr1984777fgb.39.1239403671372; Fri, 10 Apr 2009 15:47:51 -0700 (PDT) Received: from ?192.168.1.25? (16-189.62-81.cust.bluewin.ch [81.62.189.16]) by mx.google.com with ESMTPS id e11sm2622555fga.20.2009.04.10.15.47.50 (version=SSLv3 cipher=RC4-MD5); Fri, 10 Apr 2009 15:47:50 -0700 (PDT) Message-ID: <49DFCC99.3020507@gmail.com> Date: Sat, 11 Apr 2009 00:47:53 +0200 From: phcoder User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 To: The development of GRUB 2 References: <20090121211706.GA4175@pina.cat> <20090124142604.GB27695@pina.cat> In-Reply-To: <20090124142604.GB27695@pina.cat> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: carles@pina.cat Subject: Re: gettext patch (beta) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2009 22:47:58 -0000 Hello, thanks for your work. It's a nice stuff, however it has some minor problems Carles Pina i Estany wrote: >> -Copy ca.mo to /usr/share/locale/ca/LC_MESSAGES/grub.mo Languages files should go to a subdir of $PREFIX. E.g. to $PREFIX/langs/$LANG.mo linux directories may be inaccessible >> CALL FOR HELP: >> I need to write the Makefile.in (see po/TODO :-( ). I'm not used or >> familiar to write Makefiles :-( if someone wants to help it would >> speed up the process quite much. It needs only to merge the files with >> the new .pot, compile (msgfmt), and install to the correct directory. Use common.rmk, don't write directly to Makefile. >> >> I exactly know what has to do, so if someone knows about >> installation/Makefiles and doesn't know about gettext it's not a >> problem, contact me. Else I will try to implement soon. I can help you, I'm not a makefile expert but can be useful >> >> I would even invite to a couple of beers in Fosdem if someone does >> this part :-) >> >> TODO: >> -the Makefile.in >> -and more testing about 00_header with gettext detection. >> -Add _("") for mainly all strings (I would do in a separate patch) >> -I have seen that Grub2 is not printing correctly the accents, >> could be a problem in gettext or in some other layer Did you load unifont as your font? Are you in gfxterm mode? Plain pc console can't output unicode characters because it uses fixed-width 8-bit font. Perhaps loading the characters most useful for current languages to the upper 128 characters would be an option. OR we can just tell everyone to use gfxterm >> Index: conf/common.mk >> =================================================================== >> --- conf/common.mk (revision 1952) >> +++ conf/common.mk (working copy) Don't include auto-generated files in your patch >> Index: gettext/gettext.c >> =================================================================== >> --- gettext/gettext.c (revision 0) >> +++ gettext/gettext.c (revision 0) >> +static int >> +grub_gettext_get_info (int offset) >> +{ >> + int buf; Use grub_uint32_t here. Also be aware of endianness. It should be static grub_uint32_t grub_gettext_get_info (int offset) { grub_uint32_t buf; grub_file_seek (fd_mo, offset); grub_file_read (fd_mo, (char*) &buf, sizeof (buf)); buf = grub_cpu_to_le32 (buf); return buf; } Same applies multiple times in different places. grub_gettext_translation_number is a bit a misnomer because this name would suggest transforming translation into number >> + offsettranslation = grub_gettext_get_info (GETTEXT_OFFSET_TRANSLATION); >> + >> + position=offsettranslation+i*8; Please respect GCS. This should be position = offsettranslation + i * 8; >> + ret = grub_malloc(grub_strlen(orig) + 1); >> + grub_strcpy(ret,orig); >> + return ret; This would fail if the string isn't present at all in .mo >> + if (magic != 0x950412de) A define instead of hardcoded number is suggested >> + locale_prefix = grub_env_get ("locale_prefix"); You need to treat the case when no locale_prefix is defined. I suggest to put a default $prefix/locale >> + grub_sprintf (mo_file, "%s/%s/LC_MESSAGES/grub.mo", locale_prefix, lang); >> + /* XXX: lang is written by the user, need to sanitaze the input? */ I suggest grub_sprintf (mo_file, "%s/%s.mo", locale_prefix, lang); because .mo need to reside together with grub so all LC_MESSAGE is just unnecessary -- Regards Vladimir 'phcoder' Serbinenko