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: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

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

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

Post by simon.schvartzman » Tue Apr 20, 2021 1:57 pm

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 ";" or not to ";" that is the question

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

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

Post by jmburnod » Tue Apr 20, 2021 4:06 pm

Hi Simon,
You can get/set itemnames property of your widget.
Best regards
Jean-Marc
https://alternatic.ch

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

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

Post by simon.schvartzman » Tue Apr 20, 2021 4:21 pm

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 ";" or not to ";" that is the question

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

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

Post by jmburnod » Tue Apr 20, 2021 7:14 pm

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: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

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

Post by simon.schvartzman » Tue Apr 20, 2021 10:16 pm

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 ";" or not to ";" that is the question

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

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

Post by jmburnod » Tue Apr 20, 2021 10:37 pm

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: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

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

Post by simon.schvartzman » Wed Apr 21, 2021 12:31 pm

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 ";" or not to ";" that is the question

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

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

Post by jmburnod » Wed Apr 21, 2021 5:44 pm

Hi Simon,
Here is a little stack that change labels of widget using custom prop of a widget.
SetLabelsWidget.zip
(2.38 KiB) Downloaded 153 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: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

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

Post by simon.schvartzman » Wed Apr 21, 2021 5:51 pm

Thanks Jean-Marc.
Simon
________________________________________
To ";" or not to ";" that is the question

bwmilby
Posts: 438
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

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

Post by bwmilby » Thu Apr 22, 2021 1:14 pm

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.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

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

Post by simon.schvartzman » Thu Apr 22, 2021 1:19 pm

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 ";" or not to ";" that is the question

Post Reply

Return to “Talking LiveCode”