[Mono-bugs] [Bug 591545] New: Add bindings for LocalizedString 'macros' to support Comment parameter

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Mar 26 15:01:30 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=591545

http://bugzilla.novell.com/show_bug.cgi?id=591545#c0


           Summary: Add bindings for LocalizedString 'macros' to support
                    Comment parameter
    Classification: Mono
           Product: MonoTouch
           Version: SVN
          Platform: Macintosh
        OS/Version: Mac OS X 10.6
            Status: NEW
          Severity: Enhancement
          Priority: P5 - None
         Component: Class Libraries
        AssignedTo: gnorton at novell.com
        ReportedBy: craig.dunn at conceptdevelopment.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0;
Trident/4.0; GTB6.4; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR
3.5.30729; .NET CLR 3.0.30729; .NET CLR 1.1.4322)

There is a single 'localization' method bound in MT:
* NSBundle.MainBundle.LocalizedString(key, value, table)
where value is the 'default value' if no translation is found for 'key' (in
'table.strings', or if blank in 'Localizable.strings'). it is a direct binding
of the underlying localizedStringForKey:value:table: function.

>>>>Correct, it's direct binding to:

                [Export ("localizedStringForKey:value:table:")]
                string LocalizedString (string key, string value, string
table);


Apple has a set of macros on top to "aid in localization" -- they all include
'comment'
NSLocalizedString(key, comment)
NSLocalizedStringFromTable(key, tableName, comment)
NSLocalizedStringFromTableInBundle(key, tableName, bundle, comment)
NSLocalizedStringWithDefaultValue(key, tableName, bundle, value, comment)


I actually originally 'assumed' the MT binding was LocalizedString (key,
comment, table) - soon realised my mistake tho' .... i'm not sure what the
'macros' do with the comment arg, since it doesn't appear in the underlying
function -- but it _is_ very useful for generating the localization file.
because there isn't an MT method bound with 'comment' the ngenstrings tool
won't be able to generate the 'expected' output without some additional work...

Reproducible: Always

Steps to Reproduce:
Not a bug - enhancement request
Actual Results:  
Not a bug - enhancement request

Expected Results:  
Additional methods or overloads for NSBundle.MainBundle.LocalizedString()

I have been using the following extension methods in the interim...

static class Extensions 
{
/// <summary>
/// Provide a key (which is also the default value) and a comment to the
translator
/// </summary>
public static string LocalizedString (this NSBundle bundle, string key, string
comment)
{
return NSBundle.MainBundle.LocalizedString (key, key, "");
}
/// <summary>
/// Provide a key, default value, (optional="") filename and a comment to the
translator
/// </summary>
public static string LocalizedString (this NSBundle bundle, string key, string
@value, string table, string comment)
{
return NSBundle.MainBundle.LocalizedString (key, @value, table);
}
}

Enhancement requested to support
http://github.com/conceptdev/ngenstrings
which is supposed to be a MonoTouch version of 'genstrings' from the Apple SDK

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list