More info:

This is my Interface:
package pt.solidsoft.gc.language
{
[Bindable]
public interface ILanguage
{
function get LoginCompany():String
function get LoginEMail():String
function get LoginPassword():String
}
}

This is my LocaleManager:
package pt.solidsoft.gc.language
{
public class LocaleManager
{
public static const LANGUAGE_PORTUGUESE:String = "LanguagePortuguese";
public static const LANGUAGE_SPANISH:String = "LanguageSpanish";
public static const LANGUAGE_ENGLISH:String = "LanguageEnglish";

private static var languagePortuguese:ILanguage = new Portuguese();
private static var languageSpanish:ILanguage = new Spanish();
private static var languageEnglish:ILanguage = new English();

private static var selectedLanguage:String = LANGUAGE_PORTUGUESE;

public static function setLanguage(language:String):void
{
selectedLanguage = language;
}

[Bindable]
public static function get localeStrings():ILanguage
{
switch (selectedLanguage)
{
case LANGUAGE_PORTUGUESE:
return languagePortuguese;
break;
case LANGUAGE_SPANISH:
return languageSpanish;
break;
default:
return languageEnglish;
break;
}
}
}
}

And finally the use of the localization:
...
<c:FormItem label="{LocaleManager.localeStrings.LoginCompany}"
stackedLayout="true">
<c:TextInput width="250"/>
</c:FormItem>
...

I get a compile warning (DataBinding) on LoginCompany however the
DataBinding works.

If I change
from: function get LoginCompany():String
to: function LoginCompany():String
and the caller
from: {LocaleManager.localeStrings.LoginCompany()}
to: {LocaleManager.localeStrings.LoginCompany}
It works the same but the compile warning is gone.

I would prefer the getter method but without the warning.

Hugo Ferreira <[email protected]> escreveu no dia quinta, 13/08/2020
à(s) 09:52:

> If I do: FormItem label="{LocaleManager.localeStrings.LoginEMail}"
>
> I get: Warning: Data binding will not be able to detect assignments to
> 'LoginEMail'
> localeStrings returns of type Interface and at runtime it returns an
> object to implements the interface (I have [Binding] on the interface, the
> class that implements the interface and also in the LocaleManager).
>
> BUT:
>
> If I change the LoginEMail getter on the interface to a function: FormItem
> label="{LocaleManager.localeStrings.LoginEMail()}"
>
> The warning goes away.
>
> I would like to go through the getter approach instead of the method but
> this warning is pushing me away.
>
> Is I doing something wrong or this is a bug on the compiler (if so, can I
> silence this type of warning) ?
>
>

Reply via email to