History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: BOO-84
Type: New Feature New Feature
Status: Open Open
Priority: Minor Minor
Assignee: Cedric Vivier
Reporter: Josiah Burroughs
Votes: 3
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Boo

Marking strings for i18n

Created: 04/Aug/04 11:21 PM   Updated: 12/May/08 10:41 AM
Component/s: Compiler
Affects Version/s: 0.8.1
Fix Version/s: 0.9

Time Tracking:
Not Specified

Issue Links:
Related
 


 Description  « Hide
Add a method to mark strings for translation, allowing the compiler to output file containing all marked strings. Use translated strings if available in the user's locale.

Possibly similar to gettext's "_" function:

print( "Don't translate me." )
print( _"Translate me." )

See [ http://www.gnome.org/~malcolm/i18n/marking-strings.html ] for C/C++ examples.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Rafael Teixeira - 21/Aug/04 10:20 AM
I also thought of it, and think we may support either GetText and ResourceManager.GetString() mechanisms, which the user chooses using command line options at compile time.

I think the best approach is to create some macro-magic in two similar pipeline stages that some command-line option inserts in the compiling pipeline...

Personal preference: I would prefer to have "internationalized string literals" denoted by a # prefix.


Doug H - 11/Mar/06 05:21 PM
Same technique can be used that is used with BOO-1 and numeric literals.

Cedric Vivier - 09/May/07 04:46 AM
I love this!
Marking string for internationalization is such a pain in most languages and also very dependent of the implementation behind.
We should think of an extensible API to handle this cleanly.

When a string _"test" is marked the compiler would replace the literal by a call to an ITranslatableStringHandler.GetString("test") method.

Boo.Lang.I18N.Globalization.SourceCulture as CultureInfo : culture of the marked strings (can be null for undefined).
Boo.Lang.I18N.Globalization.TranslationCulture as CultureInfo : if null will take the culture of the CLR else force translate to TranslationCulture if available.
Boo.Lang.I18N.Globalization.TranslatableStringHandler as ITranslatableStringHandler : the default could be a ResourceManager-based implementation, user can set this static property for using its own implementation (using Mono.GetText for instance).

Boo.Lang.I18N.ITranslatableStringHandler
GetString(original as string) as string
FormatString(original as (string), arguments as (object)) as string

Marked string interpolations would be handled by FormatString() with the string split between the arguments.

Just my 2 cents,


Michael Dominic K. - 01/Feb/08 07:53 AM
Is there any update/progress on this?

Cedric Vivier - 01/Feb/08 08:10 AM
Seems there is none.

Are you willing to contribute?


Cedric Vivier - 12/May/08 10:41 AM
Let's make it for 0.9