Skip to content

Commit

Permalink
Fixes the translation callback not being called and allow for suggest…
Browse files Browse the repository at this point in the history
…ions on "zh-tw" and "zh-cn".
  • Loading branch information
kitsunde committed Feb 24, 2012
1 parent 9fbf953 commit b34d249
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions rosetta/templates/rosetta/js/rosetta.js
@@ -1,3 +1,5 @@
{% load rosetta %}

google.setOnLoadCallback(function() {
$('.location a').show().toggle(function() {
$('.hide', $(this).parent()).show();
Expand All @@ -13,7 +15,7 @@ google.setOnLoadCallback(function() {
var orig = $('.original .message', a.parents('tr')).html();
var trans=$('textarea',a.parent());
var sourceLang = '{{ MESSAGES_SOURCE_LANGUAGE_CODE }}';
var destLang = '{{ rosetta_i18n_lang_code|slice:":2" }}';
var destLang = '{{ rosetta_i18n_lang_code }}';
var app_id = '{{ BING_APP_ID }}';
var apiUrl = "http://api.microsofttranslator.com/V2/Ajax.svc/Translate";

Expand All @@ -31,13 +33,13 @@ google.setOnLoadCallback(function() {
appid: app_id,
from: sourceLang,
to: destLang,
oncomplete: "onTranslationComplete",
text: orig
};
$.ajax({
url: apiUrl,
data: apiData,
dataType: 'jsonp',
jsonpCallback: 'onTranslationComplete'});
dataType: 'jsonp'});
});
{% endif %}

Expand Down
2 changes: 1 addition & 1 deletion rosetta/templatetags/rosetta.py
Expand Up @@ -4,6 +4,7 @@
import re
from django.template import Node
from django.utils.encoding import smart_str, smart_unicode
from django.template.defaultfilters import stringfilter

register = template.Library()
rx = re.compile(r'(%(\([^\s\)]*\))?[sd])')
Expand All @@ -27,7 +28,6 @@ def minus(a,b):
except:
return 0
minus=register.filter(minus)


def gt(a,b):
try:
Expand Down

0 comments on commit b34d249

Please sign in to comment.