#4414: I18N Javascript interpolate function
-------------------------------------------+--------------------------------
   Reporter:  [EMAIL PROTECTED]            |                Owner:  mtredinnick 
        
     Status:  new                          |            Component:  
Internationalization
    Version:  SVN                          |           Resolution:              
        
   Keywords:  i18n javascript interpolate  |                Stage:  Accepted    
        
  Has_patch:  1                            |           Needs_docs:  0           
        
Needs_tests:  0                            |   Needs_better_patch:  0           
        
-------------------------------------------+--------------------------------
Comment (by [EMAIL PROTECTED]):

 This is not a real bug, it is more a proposal/question. In the js-function
 "interpolate" you just do a replacement of "%"-placeholders just once and
 I came to it, as i had to do two replacements like in the following
 string:[[BR]]
 {{{
 '%("count")s of %("amount")s messages'
 }}}
 
 If i call the actual js-interpolate-function i get the following result:
 
 {{{
 '1 of %("amount")s messages'
 }}}
 
 You can use the following lines as javascript-testcase:
 
 {{{
 #!js
 var transObj = { count: 1, total: 100 };
 var transStr = interpolate(gettext("%(count)s out of %(total)s"),
 transObj, true));
 print(transStr);
 }}}
 
 At the moment i solved the problem like that:
 
 {{{
 #!js
 var transStr = "1" + " " + gettext("out of") + " " + "100";
 }}}
 
 And i think, this isn't the elegant way.[[BR]]
 [[BR]]
 You're right about the popularity of this bug. Maybe not many people use
 the way you handle javascript-translations.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/4414#comment:3>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to