i18n

πŸ₯˜ Ingredients

  1. 1
    /* * cook - file construction tool * Copyright (C) 2002, 2007, 2008, 2010 Peter Miller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see * <http://www.gnu.org/licenses/>. */
  2. 2
    all,I = [fromto %0%.y %0%.yacc.c,I [match_mask %0%.y [source_files]]] [fromto %0%.c %0%.c,I [match_mask %0%.c [source_files]]] ;
  3. 3
    common,I = [fromto common/%0%.c common/%0%.c,I [match_mask common/%0%.c [source_files]] ] [fromto common/%0%.y common/%0%.yacc.c,I [match_mask common/%0%.y [source_files]] ];
  4. 4
    /* * Translate the locatization files into their binary form. This will * be different for each architecture and operating system (in theory, * if not in practice). */
  5. 5
    internationalization: lib/common.ok [fromto lib/%0%.po [arch]/lib/%0%.mo [match_mask lib/%0%.po [source_files]] ] [fromto lib/%0%.po lib/%0%.merge [match_mask lib/%0%.po [source_files]] ] LICENSE ;
  6. 6
    lib/common.ok: lib/common.pot etc/zer-len-msg.sh { sh [resolve etc/zer-len-msg.sh lib/common.pot]; touch [target]; }
  7. 7
    msgcomm = msgcomm;
  8. 8
    lib/common.pot: [prepost "lib/" ".po" [commands]] { [msgcomm]
  9. 9
    -o [target] [prepost " [need]; }
  10. 10
    msgmerge = msgmerge;
  11. 11
    lib/%0%.merge: lib/%0%.po lib/%.po { [msgmerge]
  12. 12
    -v -v
  13. 13
    -o [target] [resolve lib/%0%.po lib/%.po] ;
  14. 14
    /* * There should be no differences. * If there are, this next command will show them. */ diff -b -u [resolve lib/%0%.po] [target];
  15. 15
    /* * we only need the timestamp */ > [target]; }
  16. 16
    [arch]/lib/%0%.mo: lib/%0%.po: lib/%0common.po etc/msgfmt.sh set ['if' [not [defined baseline]] 'then' shallow] { /* * This only works for GNU gettext (and Solaris). * The SunOS msgfmt program does not grok the -o option. */ sh [resolve etc/msgfmt.sh]
  17. 17
    [resolve lib/%0%.po lib/%0common.po] ; }
  18. 18
    xgettext = xgettext;
  19. 19
    /* * These files act as a "header files" to check the lib/%0%.po files * against. There should not be any extras or omitions. */
  20. 20
    lib/common.po: [all,I] [prepost "lib/en/LC_MESSAGES/" ".po" [commands]] { /* * The author only speaks English, so the master translation is * "en", hence lib/en/LC_MESSAGES/....po are the files intended. */ [xgettext]
  21. 21
    -o [target] [prepost " [prepost "
  22. 22
    [all,I]; }
  23. 23
    lib/%.po: [%,I]: lib/en/LC_MESSAGES/common.po { /* * The author only speaks English, so the master translation is * "en", hence lib/en/LC_MESSAGES/common.po is the file * intended. */ [xgettext]
  24. 24
    -o [target] [prepost "
  25. 25
    [%,I]; }
  26. 26
    %0%.c,I: %0%.c set no-cascade { [xgettext]
  27. 27
    -o [target]
  28. 28
    [prepost " %0%.c; }
  29. 29
    /* * This next file is for the benefit of the Translation Project's * email robot. (Yes, that's right, a bloody robot.) * * See http://www.iro.umontreal.ca/contrib/po/HTML/maintainers.html * for more information. * * I particularly dislike this approach, because it is incredibly * short sighted. This approach fails to take into account that * you may want to have translations of manual pages and other * documentation, AS WELL AS translations of error messages. * * Would it make sense to ask authors to catenate all of * ther man pages together, and have a po/PACKAGE.man file? * No, of course not. Would it make sense to ask authors to * catenate all of their other documentation together, and * have a po/PACKAGE.latex file? No, of course not. Well then, * why on Earth does it make sense to catenate together all of * the messages into a po/PACKAGE.pot file? Betch. * * And then, to add insult to injury, it wastes space in the tarball. * * My project uses a directory tree * lib/ * <LL>/ * LC_MESSAGES/ * all of the various .po files go here * man<N>/ * all of the man<N> pages go here * user-guide/ * all of the files which make the * user guide go here. * <other-docs>/ * and so on... * * As you can see, this can accomodate translated .po files, * AND ALSO any other documentation, once it is translated. */
  30. 30
    po/[project_short].pot: [match_mask lib/en/LC_MESSAGES/%.po [source_files]] { msgcat
  31. 31
    -o [target] [resolve /* * Put common.po at the start, it has an informative * comment at the beginning (which gets bound to * "", and is subject a the */ lib/en/LC_MESSAGES/common.po [stringset [need] - lib/en/LC_MESSAGES/common.po ] ]; }

Actions

πŸ“₯ Download .cook File πŸ”— View Original