EddyVerbruggen / nativescript-localize

Internationalization plugin for NativeScript using native capabilities of each platform
MIT License
79 stars 31 forks source link

Text including Fa icons #27

Closed arcovoltaico closed 6 years ago

arcovoltaico commented 6 years ago

Hi, I'm trying to translate the text of a button that is prefixed by a fa-icon.

[text]="'' + ' login.fblogin' | L " class="fa fb-button"

My json: "fblogin": "Login with Facebook", // not working

" fblogin": " Login with Facebook", // detected but the fa-icon code is displayed as text as fa CSS seems to be executed before the i18n localize

And pasting the rendered icon: " fblogin": " Login with Facebook" // not working

Any idea?

Thanks a lot

jorotenev commented 6 years ago

This might be angular specific issue, because this works for me

<Button text="{{'&#xf230; ' + L('sign_in_with_fb') }}" class="btn btn-primary font-awesome"/>
arcovoltaico commented 6 years ago

Yes it's angular related. Meanwhile I found this workaround:

Component: //the &fa code is not working, had to use the copy-pasted icon: this.shareIt = " " + localize("requested.shareIt");

View: <Button class="fa" [text]="shareIt" (tap)="share()">

lfabreges commented 6 years ago

Surrounded with parenthesis: [text]="'' + ('login.fblogin' | L)" class="fa fb-button" ?

arcovoltaico commented 6 years ago

Sorry, it's not working , just renders this :  login.fblogin

lfabreges commented 6 years ago

<Label [text]="this_is_it + ('hello.world' | L)"></Label> works for me where this_is_it is just a string, hello.world is correctly translated. Is login.fblogin a key in your i18n file ? you may want to double check that.

lfabreges commented 6 years ago

I'm closing this issue as this is not something I can fix with this plugin

arcovoltaico commented 6 years ago

It is , and translated fine from localize or alone in the view. The problem cames using two pipes and the parenthesis can avoid the need of using both :-(

El 16 mar 2018, a las 20:01, Ludovic Fabrèges notifications@github.com escribió:

<Label [text]="this_is_it + ('hello.world' | L)"> works for me where this_is_it is just a string, hello.world is correctly translated. Is login.fblogin a key in your i18n file ? you may want to double check that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

arcovoltaico commented 6 years ago

I understand anyway the workaround would be helpful for others ;-)

El 16 mar 2018, a las 20:07, Ludovic Fabrèges notifications@github.com escribió:

I'm closing this issue as this is not something I can fix with this plugin

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.