summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* msgmerge: do not output to terminal when --updatetestxhe2017-11-071-0/+1
| | | | | | | i have a misunderstanding on --update, this argument is used to update the original .po file. And because we just simply copy strings from .po file, so we should just return 0, as we dont actually do anything to .po file. when --update is passed, nothing should be printed on screen.
* msgmerge: print warning instead of error on --updaterofl0r2017-11-071-1/+1
| | | | since it is not fatal anymore.
* msgfmt: dont generate file when input is emptyxhe2017-11-071-0/+11
| | | | | | GNU one does not generate useless 'only HEADER' file when input is empty, which is cleaner and reasonable in my view. I decided to do the same thing.
* msgfmt: output to messages.mo by default like GNUxhe2017-11-071-5/+6
| | | | | I noticed GNU msgfmt did not fail when i did not specific a output file, so i decided to write the output to "messages.mo" like GNU one.
* msgfmt: make in/out arguments parse code cleanerxhe2017-11-071-6/+6
| | | | | | | | | | Prepare for the next commit. 1. Using except_out_fn flag is a little complex, we could just get the filename by 'arg++ && A'. 2. i previously check except_in_fn in the block 'if (A[0] == '-')' to prevent ignoring the input file named '-..'. Again, i add similiar codes to 'A[1] == '-'' to prevent ignoring file named '--...'.
* msgfmt: stub implementation for catalog generationxhe2017-11-071-9/+23
| | | | | | | | | | | | | | | | | | | https://github.com/sabotage-linux/gettext-tiny/issues/16 Generally speaking, `-l XX -d po --language` is passed to msgfmt to generate catalog, only one standalone parameter does not make sense. As catalog has been replaced by gettext, we just stub it. Here're the changes to stub these three arguments: 1. -l is followed by a language idetifier, and for -d, it's followed by a directory, which is used to place the generated catalog files. 2. When passed `--language`, like `msgfmt --tcl...`, we cant specific -o at the same time. Gnu error: `msgfmt: --tcl and --output-file are mutually exclusive .` That means there should be no output on terminal but that `-d` despite the input file. Dont check if they're passed at the same time, as the case using `--language` is very rare, no translators are using it, but autobuild scripts, scripts only pass the correct combination.
* msgmerge: output as source when --update is passedxhe2017-10-161-12/+27
| | | | | | | | | | following https://github.com/sabotage-linux/gettext-tiny/issues/14, because there're programs using msgmerge --update, abort may break the build. As our goal is not to provide these utils of translators, we assume that nobody would actually make use of these utils. We just provide a stub to pass the build safely.
* fix: writestr() should do nothing when empty .poxhe2017-10-161-1/+4
| | | | | | | | | | | | | | https://github.com/sabotage-linux/gettext-tiny/issues/14. At line:439, writestr() is called to write down those strings that have not been wrote down in the main loop. When po files are empty, nothing is wrote down, so d->plurals_count == 0. Then, deleting 'invalid' codes in writestr() was executed wrongly. -1 is not a valid index, qsort will segfault, of course. To fix the bug, we check d->num[pe_msgid]>0, so it will do nothing when the files are empty.
* msgfmt: use more 'easy-to-read' variable namesxhe2017-10-161-80/+80
| | | | | | to make the code more clear. as rofl0r said, it's hard to understand what the code is doing without some 'tips'. now it should be clear enough that what these vars are for.
* fix: quick-fix to auto generation of po Makefilexhe2017-08-281-1/+2
| | | | | when compiling tilda, the stub Makefile lacks `install:`, which is causing errors, this is a quick fix
* readme: announce the fisrt edition of readmev0.2.0xhe2017-07-291-0/+48
| | | | made by rofl0r
* libintl: make it optional and configurablexhe2017-07-292-4/+17
| | | | | | | | | | | | | As rofl0r suggested, libintl.a now comes in two flavours, no-op or musl, or we could just disable it. no-op: gettext functions just return the input string as translation and symbols help to get past configure scripts musl: symbols as in no-op, with libintl built-in in to recent musl version Use LIBINTL=FLAVOR, FLAVOR can be NOOP(no-op), MUSL, NONE(disable)
* fix: checking the correct flagxhe2017-07-201-2/+2
| | | | | | | found when compiling git/vi.po writestr() was executed twice due to depend on the wrong flag, this could be fixed by checking 'i'. 'i' will be 0 for at least and only one time which is suitable in case.
* more strict check for fuzzy marksxhe2017-06-181-1/+1
| | | | In ki18n/cy-ver, fuzzy appeared just at the first several lines, which is making msgfmt see header as 'the obsolete'.
* avoid setting back offset in deleting the invalidxhe2017-06-181-14/+13
| | | | | Offset caculation is not only complex, but also unreliable. It's hard to say what would happened when it meets an unexpected situation. Now, writemsg() at the end, so we only need to consider d.len[], quite simpler, faster and safer than before.
* fix: handle arg -v correctlyxhe2017-06-101-1/+1
| | | | follow commit https://github.com/sabotage-linux/gettext-tiny/commit/b49e68b34d5fb5ee328bca43d98655ec4c7f25e6, correct the code
* fix: the invalid was not deletedxhe2017-05-301-21/+19
| | | | since i reconstructed the code last time(switch to writemsg()/writelstr()), it wont delete the invalid msgid/str anymore, the original code doesnt make sense. here's the new code, which could work well with writemsg()/writestr().
* fix bug of reading from stdin:xhe2017-05-271-2/+22
| | | | | | found when compiling dnsmasq we can't fseek in stdin, we can only read it for one time so now i write them to a temporary file first instead
* malloc dynamic buffer depending on .po files:xhe2017-05-201-15/+22
| | | | | failed compiling ki18n due to the static size msgstrbuf[8120] so, we now malloc dynamic buffer, and two asserts make sure safe
* fix for rule:xhe2017-05-201-1/+1
| | | | | | | | with rtype in compiling of glib, a hidden bug was found excepted: swith(msgstr, ctxt) == la_proc reality: swith(msgstr, ctxt) == la_abort the wrong rule was introduced in https://github.com/sabotage-linux/gettext-tiny/commit/d1bd158eb7463967ab3dd9a862e14d114523d37b
* replace 0x30 with '0' for better reading codexhe2017-05-201-3/+3
| | | | follow https://github.com/sabotage-linux/gettext-tiny/commit/7409501c4cdd4c8d89e6898405816c636a129dc7#commitcomment-22212741
* be more sensitive on abort:xhe2017-05-192-0/+6
| | | | | | | here the input, msgid foo; #xxx ; msgid foo2 exception: switch(msgid, msgid) == abort reality: after go through #xxx, it's now switch(invalid, msgid) == la_incr so one more value, prev_rtype is here to fix the issue
* more strict rules for reactions to abort at invalid .po filesxhe2017-05-191-2/+2
|
* fix to the mistmatch check:xhe2017-05-191-1/+1
| | | | though num[str] is allowed to be a little smaller than the maxium value, but it's not allowd to be smaller than num[msgid], which is the minimum value
* fix for nplurals:xhe2017-05-191-4/+4
| | | | do not assign 0 to nplurals, since it's used as a divisor, avoid arithmetical exceptions
* fix for nplurals:xhe2017-05-071-1/+1
| | | | | it's pure number now instead of one in ascii, 50 -> 2. i forgot to change this when i decided to translate nplurals in ascii to pure number.
* Merge pull request #10 from xhebox/full_bfull_bxhe2017-05-064-50/+287
|\ | | | | some improvements to make it a real alternative to gnu msgfmt
| * extend the buffer size of msgstr due to plural formsxhe2017-05-061-2/+2
| |
| * add assert to check if buffer is big enoughxhe2017-05-061-0/+7
| |
| * add autopoint to .gitignorexhe2017-05-061-0/+1
| |
| * add support for msgctxtxhe2017-05-063-104/+172
| |
| * skip fuzzy marked stringsxhe2017-05-061-0/+11
| |
| * small changes:xhe2017-05-061-1/+1
| | | | | | | | | | with plurals allowed <= nplurals, we can not check it accurately(!=). But it's impossible that str > the excepted maximum
| * add support for plurals:xhe2017-05-063-37/+160
| | | | | | | | | | when msgstr is empty, it's invalid. dinvalid() will delete the invalid or write them down.
| * adapt the cmd parser to newer gnu msgfmtxhe2017-05-061-1/+2
| |
| * use pe_xxx instead of 0 is more clearxhe2017-05-061-5/+5
| |
| * replace malloc with calloc to avoid futher possible problemsxhe2017-05-061-4/+4
| |
| * support converting to UTF-8xhe2017-05-012-6/+32
|/
* msgfmt: better fix for "genuine GNU check" via --statisticsrofl0r2017-03-261-3/+6
| | | | | | | | | | as discussed in bc018ee9d4483df17c45953809715df28f3b934b, configure scripts check for "GNU" by running `msgfmt --statistics /dev/null`. in our previous fix we changed --statistics from merely being ignored to just return 0, however that breaks when it is used together with other options during normal use, like: msgfmt -c --statistics --verbose -o de.gmo de.po as done by GNU coreutils.
* msgfmt: write warning to stderr if number of translations differrofl0r2017-03-261-0/+1
|
* msgfmt: fix assertion error when msgid_plural is used after msgidrofl0r2017-03-261-1/+10
|
* implement sysdep replacement as proposed by daliasrofl0r2017-03-261-11/+103
| | | | | | | | | | | | | | | the .mo format was designed in a way such that all application can used a single shared non-mutable copy of the translation strings in memory. years later an issue was identified with format string specifier macros that differ between platforms (like PRIu64) and a new syntax introduced: %<PRIuMAX>. this however breaks the non-mutable aspect of the .mo files, since now every application has to remap a modified copy of the strings containing these "sysdep" format specifiers. we simply replace these with all possible expanded values of such a macro directly in the generated .mo file.
* msgfmt: sort stringsrofl0r2017-03-261-40/+55
| | | | | | | closes #6 unfortunately the fail-safe design had to be sacrified, to effectively sort the string table we need to allocate dynamic memory.
* add latest m4 files from gnulibrofl0r2017-03-0832-500/+953
| | | | | | | | gnulib git, rev 4084b3a git://git.sv.gnu.org/gnulib.git gnulib git seems to be original source this stuff comes from. had to update because the existing m4 files had some incompatibility with latest gnu autotools when trying to build nano from git.
* autopoint: touch also ABOUT-NLSrofl0r2017-03-081-1/+1
|
* msgfmt: do not fail when --statistics is passedv0.1.0rofl0r2017-03-081-1/+3
| | | | | | | | | | | po.m4 from gnulib/gettext uses a check that this option is supported in order to exclude the FreeBSD implementation, and force the GNU version on them. http://git.savannah.gnu.org/cgit/gettext.git/tree/gettext-runtime/m4/po.m4?id=d9cfbdfecb502b70c55e594bc897c217ac082f5f#n37 it does so since several years, so it's funny we haven't hit that earlier. however this now triggers for "deadbeef" in version 0.7.2.
* threadlib.m4: remove unneeded commentrofl0r2016-12-221-53/+0
|
* initial version of autopointrofl0r2016-12-2235-2/+3912
| | | | | | | | | | | | | | | | | | | | | | | all autoconf packages that use gnu gettext for translations require a tool called autopoint in order to run `autoreconf -i`, which is the command to generate the configure script from configure.ac. this is often needed to compile git checkouts of applications, because they usually do not have the configure scripts and the other generated files checked into their version control systems. the autopoint tool is called without parameters, and it is required to copy some m4 files into place and generate some other files. this version here was created just by observing which error messages would be thrown after running it and gradually adding functionality. it was tested on a git checkout of weechat, and later on the source tarballs of various packages like glib, and it seemed to work so far. it's very likely that in future new scenarios will show up that require additional files, but what we have right now is a good start. the m4 files were taken from gnu gettext 0.18, and they are all licensed under very liberal conditions. each file has the original copyright header. there's only one m4 file i wrote myself, which is configheader.m4, supplying a macro i couldn't otherwise find in gettext's source code.
* create-dist.sh: updaterofl0r2016-10-021-4/+9
|
* xgettext: fix error when using -o /absolute/pathv0.0.5rofl0r2016-10-021-3/+7
| | | | | | | if the outputfile is given, but no outputdir specified, we shall not prefix the outputfilename with `./`. experienced during the build of weechat 1.6.