Closed (won't fix)
Project:
Simple Karma
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Nov 2007 at 16:43 UTC
Updated:
5 Dec 2007 at 10:54 UTC
JavaScript
Translate your javascript by doing
drupal_add_js(array('my_module' => array('my_string' => t('My string'))), 'setting')
Get translated strings from javascript: Drupal.settings.my_module.mystring
Same with urls:
drupal_add_js(array('my_module' => array('my_url' => url('node/10'))), 'setting')
It's more reliable and less work than using $base_path and Clean URL setting.
Source: http://www.lullabot.com/audiocast/podcast-50-drupal-tips-and-tricks
Comments
Comment #1
mercmobily commentedHi,
Nice one!
We are changing the JS as we speak.
However, once I know that everything works, I will definitely implement the base_path thing this way!
Thanks,
Merc.
Comment #2
mercmobily commentedI don't get it...
Does anybody here know what the lines above actually do?
Merc.
Comment #3
mercmobily commentedHi,
Sorry, but I am gonna have to close this one...
I spent an hour trying to figure out what on earth those guys meant in the podcast, and... I still don't get it :-/
Please send me a working, functional, explained patch if you want this to happen.
(Please don't forget to justify and explain it).
Bye,
Merc.