[pacman-dev] internationalized package descriptions?
Hello, I've been interested in i18n support for the upcoming pacman. I've noticed patches on the subject of gettext support and all that and I think that is wonderful! Now I'm thinking how it would be feasible to implement localized package descriptions. I am imagining something like pkgdesc_xx fields (xx being the language codes) in PKGBUILD scripts, and smart pacman frontends that would show the translated description string based on the users locale, if it is available (otherwise, show the english pkgdesc). Now, before I start hacking at the code, I would like to see what others think of the idea, and potential ways of designing it. I'm also interested in knowing how well adding fields like this would play out in pacman's database. I think it would be really cool if pacman had this feature :). Cheers, Maksim
2006. 05. 19, péntek keltezéssel 02.04-kor Maksim Sipos ezt írta:
Hello,
I've been interested in i18n support for the upcoming pacman. I've noticed patches on the subject of gettext support and all that and I think that is wonderful!
Now I'm thinking how it would be feasible to implement localized package descriptions. I am imagining something like pkgdesc_xx fields (xx being the language codes) in PKGBUILD scripts, and smart pacman frontends that would show the translated description string based on the users locale, if it is available (otherwise, show the english pkgdesc).
Now, before I start hacking at the code, I would like to see what others think of the idea, and potential ways of designing it. I'm also interested in knowing how well adding fields like this would play out in pacman's database. I think it would be really cool if pacman had this feature :).
Hey there! :) Sorry for answering before vmiklos :)) The idea is good. As i know (correct me if i'm wrong) now descriptions are handled via % DESC% in pacman's code. To PKGBUILD it isn't hard to implement this. But in pacman code there is much more complicated. As we know that if you follow the way pkgdesc="something" and pkgdesc_XX_yy="" scheme then we got troubles in %DESC% field. I don't know the right codepart for %DESC% processing. But i see two ways: 1. need to extend %DESC% , %DESC_XX_YY% , etc..etc.. 2. need to extend %DESC% with something like this: %DESC% en - english and core description (eqivalent to simple pkgdesc="") XX_YY - some other language description (eqivalent to pkgdesc_XX_YY="") As in the codepart we need to catch the actual locale (this is easy) . 1 situation: If we got the actual locale example: hu_HU then in codeparsing we need to "search" for %DESC_hu_HU% part instead of %DESC% one. 2 situation: If we got the actual locale: example hu_HU then we need a rewrited parser code which somehow (not want to write technical stuff here now) which pulls out from %DESC% the line stars with hu_HU . At sit 1. and sit. 2 we need to do a check if a description is available in that locale what we are running example: xx_YY if that not founded then we roll back to default english style. This is easly possible and coded too. We need to think whats better. the %DESC_XX_YY% or the %DESC% en - somedesc XX_YY - somethingdesc in other language I prefer the second way because we don't need to store unusefull newlines. So the filesize not growns too big. If this is a good idea i will work on it and code it into pacman codebase. If not a good idea i will code it too. :P Maybe just wont be commited (like my libarchive and progressbar patches ...). Waiting for comments :) Regards Christian Hamar alias krix Hungary Frugalware Developer Team
%DESC% en - somedesc XX_YY - somethingdesc in other language
Hey there. Patch ready and committed to our pacman tree to darcs. You can view below at that url. I don't know it is applies to arch pure cvs version or not. http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman;a=plain_commitdif...; Some comments. Choosed the second way so the desc style now looks like this: %DESC% Somedescription <--- This is default english no langcode need hu_HU localized desc. <--- Need a langcode (locale) and one space then translated description tr_TR another desc. <---- same Seems clean. The patch is fully backward compatible with old style. No break in packages which does not contains many translations. If no translation found for current locale then this patch fallbacks to english by default. (first line) Needed to modify in package.c package.h and be_files.c No need any modification for pacman or anything else. The frontend and everything gain back only one info->desc stuff. So the old way stay and we wont break anything with backward compatibility. Feel to free apply or disband. (as many of my patches pending now still ...) Regards Christian Hamar alias krix Hungary Frugalware Developer Team
On Sat, May 20, 2006 at 04:02:06PM +0200, Christian Hamar <krics@gds.hu> wrote:
%DESC% en - somedesc XX_YY - somethingdesc in other language
Hey there. Patch ready and committed to our pacman tree to darcs. You can view below at that url. I don't know it is applies to arch pure cvs version or not.
http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman;a=plain_commitdif...;
to continue the story, the parse_descfile() function in libalpm/package.c has been updated, too. also the scripts (makepkg,gen/updatesync) and the manpage darcsweb urls: http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman;a=commitdiff;h=20... http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman;a=commitdiff;h=20... http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman;a=commitdiff;h=20... http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman;a=commitdiff;h=20... http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman;a=commitdiff;h=20... udv / greetings, VMiklos -- Developer of Frugalware Linux, to make things frugal - http://frugalware.org
participants (3)
-
Christian Hamar
-
Maksim Sipos
-
VMiklos