Author Topic: [solved] Localization text with callbacks?  (Read 3875 times)

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
[solved] Localization text with callbacks?
« on: April 08, 2013, 06:22:45 PM »
There's any way to introduce callback in localized strings?


For example:
Hi <user>, it's been a while since we met.


And <user> is defined in other screen with and  input widget.


is this possible?


Thanks!
« Last Edit: April 10, 2013, 10:34:29 AM by jeldrez »

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Text with callbacks?
« Reply #1 on: April 09, 2013, 01:58:48 AM »
Consider using string.Format?

  1. string.Format("Hello {0}. How are you today?", mName);

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: Text with callbacks?
« Reply #2 on: April 09, 2013, 01:04:10 PM »
But I've the string in the .txt file for localization.
can I string format the key?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Text with callbacks?
« Reply #3 on: April 09, 2013, 09:39:31 PM »
label.text = string.Format(Localization.Localize("Some Key"), 123);

Some Key = There are {0} questions in this forum

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: Text with callbacks?
« Reply #4 on: April 10, 2013, 10:33:47 AM »
Thanks a lot Aren!