java: make the syntax error format string translatable

The error format should be translated, but contrary to the case of
C/C++, we cannot just depend on macros to adapt on the
presence/absence of '_'.  Let's consider that the message format is to
be translated iff there are some internationalized tokens.

* src/output.c (prepare_symbol_names): Define b4_has_translations.
* data/skeletons/java.m4 (b4_trans): New.
* data/skeletons/lalr1.java: Use it to emit translatable or not the
format string.
This commit is contained in:
Akim Demaille
2020-02-07 08:40:35 +01:00
parent 088356cb2f
commit 18a7cfc7cf
3 changed files with 24 additions and 9 deletions

View File

@@ -226,6 +226,13 @@ m4_define([b4_symbol_translate],
[[_($1)]])
# b4_trans(STRING)
# ----------------
# Translate a symbol. Avoid collision with b4_translate.
m4_define([b4_trans],
[m4_if(b4_has_translations, 0, [$1], [_($1)])])
# b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
# ----------------------------------------------