Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [babel-dev] DO NOT TRANSLATE properties files and quote handling


Denis,

>1. Preventing a string from being translated:
>-> I suggest we use a well-known convention, such as adding // $NON_NLS-1$ at the end of the line.

You must be talking about the special comment in Java files. This will work if the developer uses the PDE's "Externalize Strings" function, evaluate if each string should be translated, and then externalize the strings. I've seen programmers blindly externalize all strings to properties files. We need special comments in properties files to exclude files or strings.

As for single quote handling (I mentioned both topics in one posting because they are kind of related), we've been using the following convention in house. If we all agree, we can continue to use this convention, and add this to a "best practices" document to be posted at our Babel Project Wiki.

Special comments in properties files for single quote handling:
# NLS_MESSAGEFORMAT_ALL
# NLS_MESSAGEFORMAT_NONE
# NLS_MESSAGEFORMAT_VAR

All strings, either up to the next NLS_MESSAGEFORMAT comment or the end of the file, are handled as follows:

NLS_MESSAGEFORMAT_ALL
Each string is assumed to be processed by the MessageFormat class (single quote must be coded as 2 consecutive single quotes '').

NLS_MESSAGEFORMAT_NONE
All strings are assumed to NOT be processed by the MessageFormat class (single quote must be coded as 1 single quote ').

NLS_MESSAGEFORMAT_VAR
Strings which contain replacement variables are processed by the MessageFormat class (single quote must be coded as 2 consecutive single quotes ''). Strings which do NOT contain replacement variables are NOT processed by the MessageFormat class (single quote must be coded as 1 single quote ').

Kit Lo
IBM Eclipse SDK Globalization Technical Lead



Denis Roy <denis.roy@xxxxxxxxxxx>
Sent by: babel-dev-bounces@xxxxxxxxxxx

11/26/2007 02:38 PM

Please respond to
Babel committers mailing list <babel-dev@xxxxxxxxxxx>

To
Babel committers mailing list <babel-dev@xxxxxxxxxxx>
cc
Subject
Re: [babel-dev] DO NOT TRANSLATE properties files and quote handling





Kit,

I'm guessing this only applies to .properties files. Now is the best time to discuss these conventions.

1. Preventing a string from being translated:
-> I suggest we use a well-known convention, such as adding // $NON_NLS-1$ at the end of the line.

2. Preventing an entire file from being translated:
-> How about adding a comment, at the top of the file: # $NON_NLS-1$

As for specific quoting, I don't have specific suggestions, but again, assuming one line per string, placing a specific identifier at the end of the string (or as a comment in the file) allows us to properly handle it.

Denis




Kit Lo wrote:


A question for Paul, Dennis or Gabe: When we load the translation server with translatable files, is there a way to mark a file, or strings in a file as DO NOT TRANSLATE? I've seen a few cases where a file, or strings in a file, should not be translated. Otherwise, the code logic will not work.

If we don't have a way to do that now, we have to come up with a system, like a special comment in the file, so we can skip translating the file or strings. Maybe we can do something in Pascal's Message Editor side. Pascal, any comment?

We also need a way for the developer of the properties file to tell us if the file will be processed by Java MessageFormat class. Depending on whether the file would be processed by Java MessageFormat class, quotes need to be doubled sometimes. Again, some special comment in the file will solve the problem. Any other ideas?


Kit Lo
IBM Eclipse SDK Globalization Technical Lead




_______________________________________________
babel-dev mailing list
babel-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/babel-dev
 


--
Denis Roy
Manager, IT Infrastructure
Eclipse Foundation, Inc.  --  
http://www.eclipse.org/
Office: 613.224.9461 x224 (Eastern time)
Cell: 819.210.6481
denis.roy@xxxxxxxxxxx_______________________________________________
babel-dev mailing list
babel-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/babel-dev


Back to the top