Using custom properties for localization: how to for Navigation Bar Widget

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
simon.schvartzman
Posts: 672
Joined: Tue Jul 29, 2014 12:52 am

Using custom properties for localization: how to for Navigation Bar Widget

Post by simon.schvartzman »

Hi humans (robots are not welcomed)...

I'm using Custom Properties to localize my script (thanks to @trevix for showing me the way) and is working fine for Labels and Buttons but can't make it work for changing the labels of a Navigation Bar Widget.

I set up a Custom property like this:

Code: Select all

cREVGeneral
   profileList
      Master
      Spanish
for a label:

Code: Select all

cREVDivergedSpanish
   htmlText
      <p>Español</p>
and for a button:

Code: Select all

cREVDivergedSpanish
   label
      Boton Español
and when revSetStackFileProfile "Spanish", "myCard" is called they magically change from English (which is the original language) to Spanish

Question, how should I set up the custom property for a Navigation Bar Widget in order to change the Navigation data labels?

Would it be possible? How?

Human here says thanks!
Simon
________________________________________
To "AI", or not to "AI", that is the question
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Using custom properties for localization: how to for Navigation Bar Widget

Post by jmburnod »

Hi Simon,
You can get/set itemnames property of your widget.
Best regards
Jean-Marc
https://alternatic.ch
simon.schvartzman
Posts: 672
Joined: Tue Jul 29, 2014 12:52 am

Re: Using custom properties for localization: how to for Navigation Bar Widget

Post by simon.schvartzman »

Hi Jean-Marc, I guess I was not clear enough with my question. I'm aware I can set/get item names of widgets my question is how to do it using customProperties...
Simon
________________________________________
To "AI", or not to "AI", that is the question
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Using custom properties for localization: how to for Navigation Bar Widget

Post by jmburnod »

As far i know widget doesn't have custom properties but you can use custom properties of others controls
Jean-Marc
https://alternatic.ch
simon.schvartzman
Posts: 672
Joined: Tue Jul 29, 2014 12:52 am

Re: Using custom properties for localization: how to for Navigation Bar Widget

Post by simon.schvartzman »

Jean-Marc I'm humble opinion widgets do have custom properties.

I hope someone with better knowledge than myself will enter the conversation to clarify...

Anyway many thanks for your replies

Best
Simon
________________________________________
To "AI", or not to "AI", that is the question
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Using custom properties for localization: how to for Navigation Bar Widget

Post by jmburnod »

Sorry I was wrong, widgets have custom properties indeed
I understand you want change itemnames of widget when user change langage Correct ?
https://alternatic.ch
simon.schvartzman
Posts: 672
Joined: Tue Jul 29, 2014 12:52 am

Re: Using custom properties for localization: how to for Navigation Bar Widget

Post by simon.schvartzman »

I understand you want change itemnames of widget when user change langage Correct ?
Yes this is what I want to accomplish, I know how to do it from a stack, my doubt is if it is doable using custom properties.
Simon
________________________________________
To "AI", or not to "AI", that is the question
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Using custom properties for localization: how to for Navigation Bar Widget

Post by jmburnod »

Hi Simon,
Here is a little stack that change labels of widget using custom prop of a widget.
SetLabelsWidget.zip
(2.38 KiB) Downloaded 318 times

Code: Select all

on menupick pItemName
   put the  pItemName of widget 1 into tVar
   set the itemlabels of widget 1 to tVar
end menupick
Jean-Marc
https://alternatic.ch
simon.schvartzman
Posts: 672
Joined: Tue Jul 29, 2014 12:52 am

Re: Using custom properties for localization: how to for Navigation Bar Widget

Post by simon.schvartzman »

Thanks Jean-Marc.
Simon
________________________________________
To "AI", or not to "AI", that is the question
bwmilby
Posts: 464
Joined: Wed Jun 07, 2017 5:37 am
Contact:

Re: Using custom properties for localization: how to for Navigation Bar Widget

Post by bwmilby »

What you are actually running up against is the fact that the profile manager library has not been updated to handle widgets. That is probably one reason that the UI for it was not included in the IDE update.
simon.schvartzman
Posts: 672
Joined: Tue Jul 29, 2014 12:52 am

Re: Using custom properties for localization: how to for Navigation Bar Widget

Post by simon.schvartzman »

Thanks Brian, I guess somehow I already knew that would be the answer to my question...

Anyway I developed a small function to handle the localization through a stack. Not ideal but does the job

Best
Simon
________________________________________
To "AI", or not to "AI", that is the question
Post Reply