CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 Easy way to localize your JavaScript using CCS localization utilities

Print topic Send  topic

Author Message

Posts: 220
Posted: 02/22/2013, 2:07 PM


Recently during development I started do delve more and more into JavaScript jQuery libraries and doing more and more interactive client-side coding.

Today I started to create my own jQuery library for JavaScript that simplifies adding jQuery client-side objects to my project.

Anyway one of the things I encountered is how to best use the localization resource files from CCS to localize my jQuery functions. I have found out an easy solution that uses CCS mechanisms that is already used to translate CCS generated js files. And it all took 5 minutes to set up!

1. CCS uses ClientI18N.php file to parse JS files to enable localisation. Create a copy of this file, and name it like "ClientI18N_Custom.php".

2. Open the new file in CCS or external editor and edit the following REGEX lines, so your custom JS file is allowed to be parsed:
$AllowedFiles = array(  
    "/^DatePicker\\.js$/" => "content-type: text/javascript; charset=$ClientFileEncoding",  
    "/^Functions\\.js$/" => "content-type: text/javascript; charset=$ClientFileEncoding",  
    "/^[\\w\\/]+_events\\.js$/" => "content-type: text/javascript; charset=$ClientFileEncoding"  
Remember to publish the new php file to the server !

3. In your HTML file link your custom JS file, so it's loaded through ClientI18N_Custom.php:
<script language="JavaScript"   
  type="text/javascript" charset="utf-8"></script>

4. In your custom functions you can now use the same resource localisations, like you do in HTML:

function foo() {  
  var translatedString = "{res:my_localized_string}";  

5. Profit 8-)
View profile  Send private message
Posted: 02/22/2013, 4:11 PM

Very nice.

Posts: 1
Posted: 09/04/2013, 11:52 PM

That's excellent. I'd become resigned to disabling paging and sorting when using stored procedures. I'll try this next time.

_________________ [url=][/url]
pass4sure network+ test questions [url=]pass4sure network+ test questions[/url]
View profile  Send private message

Add new topic Subscribe to topic   

These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by  and YesSoftware, Inc.