Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2002:
[Freeciv-Dev] Few ideas and questions about NLS
Home

[Freeciv-Dev] Few ideas and questions about NLS

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc:
Subject: [Freeciv-Dev] Few ideas and questions about NLS
From: <matusik_s@xxxxx>
Date: Fri, 25 Jan 2002 08:04:23
Reply-to: matusik_s@xxxxx

Looking through Freeciv configuration scripts I get the 
impression that po/Makefile.in.in cannot be changed.
Why?

Aren't OUTPUT_COMANDS from configure.in too dirty?

1)
It would be much better if Makefile.in.in was:

$(srcdir)/$(PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in
        $(XGETTEXT) --default-domain=$(PACKAGE) --
directory=$(top_srcdir) \
          --add-comments --keyword=_ --keyword=N_ @extra_keywords@\
          --files-from=$(srcdir)/POTFILES.in \
        && test ! -f $(PACKAGE).po \
           || ( rm -f $(srcdir)/$(PACKAGE).pot \
                && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )

./configure would check present version of xgettext and choose 
correct value
for @extra_keywords@ (--keyword=Q_ --keyword=PL_ or --keyword=Q_ --
keyword=PL_1,2)

2)
If msgfmt doesn't understand msgid_plural there should be a program 
which
converts new .po into old style:

msgid "singular"
msgid_plural "plural"
msgstr[0] "plural case 0"
msgstr[1] "plural case 1"
...
msgstr[N] "plural case N"

into

msgid "singular"
msgstr "plural case 0"

msgid "plural"
msgstr "plural case N"

 

.po.mo: ./convert
        ./convert $< tmp.po
        $(MSGFMT) -o $@ tmp.po
        rm -f tmp.po

./convert: convert.cpp
        $(CC) convert.cpp -o ./convert

3)
Finaly, common/fcintl.h: 

#define _(String) gettext(String)
#define N_(String) String
#define Q_(String) skip_intl_qualifier_prefix(gettext(String))
#ifdef HAVE_NGETTEXT
#define PL_(String1, String2, n) ngettext((String1), (String2), (n))
#else
#define PL_(String1, String2, n) (n == 1 ? gettext(String1) : gettext
(String2))
#endif

4)
Of course if you didn't have correct versions of gettext, msgfmt, 
xgettext, you
wouldn't be able to create translations, but you would be able to 
download, 
compile, and play Freeciv.

ad 1)
AC_MSG_CHECKING(xgettext version > 0.10.38)
xgettext_version=`$XGETTEXT --version`
AC_TRY_RUN([
#include <stdio.h>
const char* version = "$xgettext_version";
int main(){
  int major, minor, patch;
  sscanf(version, "xgettext (GNU gettext) %d.%d.%d", &major, &minor, 
&patch );
  if (major < 1 && ( minor < 10 || (minor == 10 && patch < 39))) 
return 1;
  return 0;
}
],
[
 xgettext_version="yes"
 extra_keywords="--keyword=Q_ --keyword=PL_:1,2"
],
[
 xgettext_version="no"
 extra_keywords="--keyword=Q_ --keyword=PL_"
],
xgettext_version="bad"
)
AC_MSG_RESULT($xgettext_version)
AC_SUBST(extra_keywords)

---
mateusz



[Prev in Thread] Current Thread [Next in Thread]