www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19776] New: [internals] Support i18n in error messages


          Issue ID: 19776
           Summary: [internals] Support i18n in error messages
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

Created attachment 1743
  --> https://issues.dlang.org/attachment.cgi?id=1743&action=edit
French translation of expressionsem.d, and others.

Attaching a partial translation that was done by the French Translation team by
accident (I forgot to update the EXCLUDES for new files).

For brevity, posting a few random examples from that file:


 msgid "`%s` is not defined, perhaps `import %s;` is needed?"
 msgstr "« %s » n'est pas défini, peut-être que « import %s; » est
nécessaire ?"

 msgid "cannot delete instance of COM interface %s"
 msgstr "impossible de supprimer l'instance de l'interface COM %s"

 msgid "field %s.%s cannot modify fields in  safe code that overlap fields with
other storage classes"
 msgstr "le champs %s.%s ne peut pas modifier des champs dans du code  safe qui
recouvre des champs avec d'autres classes de stockage"

 msgid "expression %s of type %s does not have a boolean value"
 msgstr "l'expression %s de type %s n'a pas une valeur booléenne"
--- This will be deleted, however I'm not opposed to this sort of work being done, it would be great if the dmd front-end was more fit for purpose in order to allow such work to be undertaken. One example where i18n can be frustrated by the front-end, is by some cases where errors are squashed into a programmatically computed message (to save a couple of lines?) For example, in expressionsem.d there is this piece of code:
 const(char)* s = exp.op == TOK.plusPlus ? "increment" : "decrement";
 exp.error("cannot post-%s array slice `%s`, use pre-%s instead", s,
exp.e1.toChars(), s);
The string "cannot post-%s ..." will be extracted for translation, but the inserted words, "increment" and "decrement", will not. At a minimum, these words need to be marked for translation too, however the better option is to make it two complete messages. While for some languages it would work to compose the sentence in the same way as the original format, it would be safe to assume that languages further removed from English would have more trouble. --
Mar 30 2019