Internationalisation

The Maia character set is UTF-8, and mtv fully supports UTF-8. So, if you're smart enough, you can write code in Sumero-Akkadian Cuneiform. However, this isn't the full story, since mtv generates Verilog code, and many Verilog simulators support only the printable ASCII character set.

Consider this program:

main() {
   report("Καλημέρα κόσμε\n");
}

If this is saved as test4.tv, and compiled and run as rtv test4.tv, then one simulator on my system will actually output Καλημέρα κόσμε. However, a second simulator will instead output an arbitrary character sequence. If you need UTF-8 output, you'll therefore need to make sure that your simulator supports it. However, comments and variable names can always be written in arbitrary UTF-8, since the comments do not appear in the Verilog output, and variable names are transformed before output.

The compiler warning and error messages can be translated into arbitrary languages by customising the i18n.txt file, at the top level of the distribution. This file contains all the compiler message output, with the exception of a small number of runtime messages, and internal errors. Note, however, that if you're changing a runtime message rather than a compiler message, you'll first need to confirm that your simulator can display any UTF-8 characters in your message.

i18n.txt contains English-language templates for the messages, together with placeholders for specific tokens which are either compiler-determined, or which were extracted from your own source code. You can create your own version by replacing the default message with a UTF-8 string. Error 545, for example, is defined in i18n.txt as:

  /**
   * @param 0 string
   * @param 1 integer
   */
  E545 "'%0' is not a valid pipeline level (the allowable range is [1, %1])"

The compiler substitutes %0 with a string which was found in your source code. If you asked for a pipeline delay of 5000 cycles (->5000), for example, then %0 will be "5000". %1 is supplied by the compiler, and is the maximum allowed pipeline delay. Let's say, for example, that the compiler allows a maximum pipeline delay of 1024 cycles. In this case, the actual error message produced by mtv will be:

(Error) 'test.tv', line 13: (E545) '5000' is not a valid pipeline level (the allowable range is [1, 1024])

To translate this into another language, you will need to replace the English text in the template message, and place %0 and %1 at the locations where they should appear in the new message.

If i18n.txt is deleted, or if a message does not appear in the file, then the default English-language message will be used. Please note that there are no 'official' versions of i18n.txt, apart from the original version in the distribution. If you are reporting a bug, you should first delete i18n.txt, or revert to the original version, so that your error report shows the default error message.