[haiku-development] Re: How to add file names to a catalog at build time?

  • From: "Ingo Weinhold" <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 13 May 2013 14:59:57 +0200 (CEST)

"John Scipione" <jscipione@xxxxxxxxx> wrote:
> I am trying to internationalize the keymap names and keyboard layout
> names that appear in the Keymap preflet. In order to do that I need to
> add the keymap and layout file names to Keymap's catalog.
> 
> I'd prefer that the catalog entries were auto-generated from the file
> names so that we don't have to maintain a separate list. That means
> building a header file at compile time that contains the names and
> then including it in the Keymap preflet's Jamfile.
> 
> What I'm thinking of is a header file that has a bunch of
> B_TRANSLATE_MARK("<keymap_name>"); entries and then in Keymap I issue
> B_TRANSLATE_NOCOLLECT("<keymap_name>") to get the localized name out
> of the catalog.
> 
> I've created the list manually by just filling out the keymap names
> which seems to work, but, like I said, I'd prefer to fill out the
> catalog from the file names at compile time directly.
> 
> We are already looping through the list of keymaps and keyboard
> layouts in HaikuImage to add the files to the image, would it be
> possible to use Jam to build a header file that could be used to
> included by the Keymap preflet?

Yes it is possible (see attached patch). Unfortunately, since jam cannot know 
when the input for the generated header changes, it has to be marked Always 
(i.e. it will always be considered out-of-date).

CU, Ingo












Other related posts: