Portal Engine
Version 3.x > Portal Engine > Localize Image n of m of lightbox display View modes: 
User avatar
Member
Member
jsalichos-gmail - 1/1/2009 4:37:40 AM
   
Localize Image n of m of lightbox display
How to localize "Image n of m" of lightbox display?

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 1/2/2009 3:36:49 PM
   
RE:Localize Image n of m of lightbox display
Hello,

You can edit this text in the file lightbox.js in ~CMSWebParts\Viewers\lightbox_files\. You can find it around line 521:

// if image is part of set display 'Image x of x'
if(imageArray.length > 1){
Element.show('numberDisplay');
Element.setInnerHTML( 'numberDisplay', "Image " + eval(activeImage + 1) + " of " + imageArray.length);
}

Best Regards,
Boris Pocatko

User avatar
Member
Member
jsalichos-gmail - 1/4/2009 2:34:46 AM
   
RE:Localize Image n of m of lightbox display
Doesn't this solution restricts me to one language only or you mean that I could use Localization Expressions?

thanks,

John



User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 1/7/2009 8:47:59 AM
   
RE:Localize Image n of m of lightbox display
Hello,

You could create an own Localization String. All the resouce strings are located in the files in the ~CMSResources folder. Here is an example on how it could look like:

The current code:
"Image " + eval(activeImage + 1) + " of " + imageArray.length

The new one:
String.Format(ResHelper.GetString('...'), eval(activeImage + 1), imageArray.length);

The '...' should contain a resource string. It could look like this one:
Image {0} of {1}

You can take a look how we are using resource strings. You can find an example in the ~\App_Code\CMSModules\ImportExport\ImportExportControl.cs file around the line 202 (4.0beta version).

In the resource file should be an entry similar to this one:

<data name="import.limitzero" xml:space="preserve">
<value>Best available license does not allow any {0}, please unselect all {0}.</value>
</data>

I hope this helps.

Best Regards,
Boris Pocatko.

User avatar
Member
Member
jsalichos-gmail - 1/10/2009 3:25:30 AM
   
RE:Localize Image n of m of lightbox display
Thanks for the answer but is ResHelper known to js code?

regards,

John

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 1/22/2009 11:10:48 AM
   
RE:Localize Image n of m of lightbox display
Hello,

I am sorry for the delay.

Thank you for pointing this out. Unfortunately the JS file doesn't know the ResHelper, my mistake. If you want to customize this string according to the culture, you will have to use variables, which will be filled with values in the ASPX file, you are using the LightBox. The variables (strings) will be filled according the culture and with help of the ResHelper, as I described earlier.

I hope this makes sense.

Best Regards,
Boris Pocatko