瀏覽代碼

Merge branch 'master' of http://192.168.136.45:3000/SERVER/langer

pengzhibo168 5 年之前
父節點
當前提交
d5928b055a
共有 2 個文件被更改,包括 8 次插入4 次删除
  1. 7 4
      controller/LangArea.py
  2. 1 0
      web/js/jqhttpsdk.js

+ 7 - 4
controller/LangArea.py

@@ -113,6 +113,7 @@ class LangAreaView(TemplateView):
         return response.json(0, list(la_qs))
 
     def do_export(self, request_dict, response, userID):
+        print("进来了")
         id = request_dict.get('id', None)
         type = request_dict.get('type', None)
         # key_list = LangKeyModel.objects.filter().values_list('word_key', flat=True)
@@ -133,7 +134,8 @@ class LangAreaView(TemplateView):
                 elif en_kv[r['word_key']]:
                     res[r['word_key']] = en_kv[r['word_key']]
             for l in res:
-                content = content + '"' + l + '"="' + res[l] + '";\n'
+                content_val = res[l].replace('"', '\'')
+                content = content + '"' + l + '"="' + content_val + '";\n'
         elif type == 'android':
             res_qs = LangKeyModel.objects.filter(langvalmodel__la__id=id).\
                 values('word_key', 'langvalmodel__word_val').order_by('addTime')
@@ -148,7 +150,8 @@ class LangAreaView(TemplateView):
                 lk = l
                 lk = lk.replace('.', '_')
                 lk = lk.replace('\\n', '_')
-
+                lk = lk.replace('“', '_')
+                lk = lk.replace('”', '_')
                 lk = lk.replace(' ', '_')
                 lk = lk.replace('\\\'', '_')
                 lk = lk.replace('\'', '_')
@@ -169,7 +172,8 @@ class LangAreaView(TemplateView):
                 lk = lk.replace('‘', '_')
                 # 正则表达式
                 # re.sub("[a-z]+", "$", "123abc78ab9cdeg00t8")
-                content = content + '<string name="' + lk + '">' + res[l] + '</string>\n'
+                content_val = res[l].replace("'","\\'")
+                content = content + '<string name="' + lk + '">' + content_val + '</string>\n'
         response = StreamingHttpResponse(content)
         response['Content-Type'] = 'application/octet-stream'
         response['Content-Disposition'] = 'attachment;filename="lang.txt"'
@@ -193,7 +197,6 @@ class exportLangView(TemplateView):
 
     def validate(self, request_dict):
         # 得到即将下载文件的路径和名称
-
         response = StreamingHttpResponse('123l4kjlkfjlksadjlfksdajlf')
         response['Content-Type'] = 'application/octet-stream'
         response['Content-Disposition'] = 'attachment;filename="lang.txt"'

+ 1 - 0
web/js/jqhttpsdk.js

@@ -13,6 +13,7 @@ var http_ip_prot = convertTemp()+ "/";
 	if( http_ip_prot.indexOf("zositech")==-1){
 		http_ip_prot="http://192.168.136.39:8000/";
     	http_ip_prot = 'http://47.107.129.126:7724/';
+    	// http_ip_prot = 'http://127.0.0.1:8000/'
     	// http_ip_prot = 'http://192.168.136.40:7724/';
     	// let http_ip_prot = 'http://192.168.136.40:7724/';
 		console.log(http_ip_prot);