About Auto Translate PluginAuto Translate Plugin is supported since ve dịch - About Auto Translate PluginAuto Translate Plugin is supported since ve Việt làm thế nào để nói

About Auto Translate PluginAuto Tra

About Auto Translate Plugin
Auto Translate Plugin is supported since version 1.6.2. However, we just opened the interface to developers. To develop a plugin, we need to develop a standalone app, which could get translate request, do the translation, and then set the translate result. Here is a simple description for how to develop a translate plugin.

Get Translate Request
We pass the translate request by TranslateItem which is defined as:

package com.gmail.heagoo.apkeditor.translate;

import java.io.Serializable;

// MUST be defined as this, cannot be proguarded
public class TranslateItem implements Serializable {

private static final long serialVersionUID = -3101805950698159689L;
public String name;
public String originValue;
public String translatedValue;

public TranslateItem(String _n, String _o) {
this.name = _n;
this.originValue = _o;
}

public TranslateItem(String _n, String _o, String _t) {
this.name = _n;
this.originValue = _o;
this.translatedValue = _t;
}
}

And, please refer to following code to get all the passed parameters:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// ...
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
// Target language code like "-de"
this.targetLanguageCode = bundle.getString("targetLanguageCode");
// Translated items are also passed, so that we can revise it
this.translatedFilePath = bundle.getString("translatedList_file");
this.translatedList = (List) readObjectFromFile(translatedFilePath);
// Untranslated items, which are to be translated
String path =bundle.getString("untranslatedList_file");
this.untranslatedList = (List) readObjectFromFile(path);
// ...
}

public static Object readObjectFromFile(String filePath) {
Object result = null;
File file = new File(filePath);
ObjectInputStream objIn = null;
try {
objIn = new ObjectInputStream(new FileInputStream(file));
result = objIn.readObject();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} finally {
closeWithoutThrow(objIn);
}
return result;
}

Set Translate Result
After the translation, we should return back the result using following code:

private void setResult(List stringValues) {
Intent intent = new Intent();
intent.putExtra("targetLanguageCode", this.targetLanguageCode);
writeObjectToFile(this.translatedFilePath, stringValues);
intent.putExtra("translatedList_file", this.translatedFilePath);

this.setResult(RESULT_OK, intent);
}

public static void writeObjectToFile(String filePath, Object obj) {
File file = new File(filePath);
ObjectOutputStream objOut = null;
try {
objOut = new ObjectOutputStream(new FileOutputStream(file));
objOut.writeObject(obj);
objOut.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
closeWithoutThrow(objOut);
}
}

AndroidManifest Requirement
In general, we should request permissions like (as we may use online translators):



And, to make APK Editor can find the plugin, we should declare the activity like:




0/5000
Từ: -
Sang: -
Kết quả (Việt) 1: [Sao chép]
Sao chép!
Về tự động dịch PluginTự động dịch Plugin được hỗ trợ kể từ phiên bản 1.6.2. Tuy nhiên, chúng ta chỉ cần mở giao diện để phát triển. Để phát triển một plugin, chúng ta cần để phát triển một ứng dụng độc lập, có thể nhận được yêu cầu dịch, do dịch, và sau đó thiết lập kết quả dịch. Đây là một mô tả đơn giản để làm thế nào để phát triển một plugin dịch. Nhận dịch yêu cầuChúng tôi vượt qua các yêu cầu dịch bởi TranslateItem được xác định như: gói com.gmail.heagoo.apkeditor.translate; java.io.Serializable nhập khẩu; PHẢI được xác định như thế này, có thể không là proguardedthực hiện công cộng lớp TranslateItem Serializable {} riêng static cuối cùng dài serialVersionUID =-3101805950698159689 L; tên Chuỗi công cộng; khu vực chuỗi originValue; khu vực chuỗi translatedValue; khu vực TranslateItem (String _n, String _o) {} this.name = _n; this.originValue = _o; } khu vực TranslateItem (String _n, String _o, Chuỗi _t) {} this.name = _n; this.originValue = _o; this.translatedValue = _t; }} Và xin vui lòng tham khảo các mã sau đây để có được tất cả các thông số thông qua: @Override Protected void onCreate(Bundle savedInstanceState) {} super.onCreate(savedInstanceState); // ... Intent intent = getIntent(); Gói bó = intent.getExtras(); Mã nhắm mục tiêu ngôn ngữ như "-de" this.targetLanguageCode = bundle.getString("targetLanguageCode"); Dịch bài cũng được thông qua, do đó chúng tôi có thể sửa lại nó this.translatedFilePath = bundle.getString("translatedList_file"); this.translatedList = (List) readObjectFromFile(translatedFilePath); // Untranslated items, which are to be translated String path =bundle.getString("untranslatedList_file"); this.untranslatedList = (List) readObjectFromFile(path); // ... } public static Object readObjectFromFile(String filePath) { Object result = null; File file = new File(filePath); ObjectInputStream objIn = null; try { objIn = new ObjectInputStream(new FileInputStream(file)); result = objIn.readObject(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } finally { closeWithoutThrow(objIn); } return result; } Set Translate ResultAfter the translation, we should return back the result using following code: private void setResult(List stringValues) { Intent intent = new Intent(); intent.putExtra("targetLanguageCode", this.targetLanguageCode); writeObjectToFile(this.translatedFilePath, stringValues); intent.putExtra("translatedList_file", this.translatedFilePath); this.setResult(RESULT_OK, intent); } public static void writeObjectToFile(String filePath, Object obj) { File file = new File(filePath); ObjectOutputStream objOut = null; try { objOut = new ObjectOutputStream(new FileOutputStream(file)); objOut.writeObject(obj); objOut.flush(); } catch (IOException e) { e.printStackTrace(); } finally { closeWithoutThrow(objOut); } } AndroidManifest RequirementIn general, we should request permissions like (as we may use online translators): Và, để làm cho APK Editor có thể tìm thấy các plugin, chúng ta cần khai báo các hoạt động như:
đang được dịch, vui lòng đợi..
 
Các ngôn ngữ khác
Hỗ trợ công cụ dịch thuật: Albania, Amharic, Anh, Armenia, Azerbaijan, Ba Lan, Ba Tư, Bantu, Basque, Belarus, Bengal, Bosnia, Bulgaria, Bồ Đào Nha, Catalan, Cebuano, Chichewa, Corsi, Creole (Haiti), Croatia, Do Thái, Estonia, Filipino, Frisia, Gael Scotland, Galicia, George, Gujarat, Hausa, Hawaii, Hindi, Hmong, Hungary, Hy Lạp, Hà Lan, Hà Lan (Nam Phi), Hàn, Iceland, Igbo, Ireland, Java, Kannada, Kazakh, Khmer, Kinyarwanda, Klingon, Kurd, Kyrgyz, Latinh, Latvia, Litva, Luxembourg, Lào, Macedonia, Malagasy, Malayalam, Malta, Maori, Marathi, Myanmar, Mã Lai, Mông Cổ, Na Uy, Nepal, Nga, Nhật, Odia (Oriya), Pashto, Pháp, Phát hiện ngôn ngữ, Phần Lan, Punjab, Quốc tế ngữ, Rumani, Samoa, Serbia, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenia, Somali, Sunda, Swahili, Séc, Tajik, Tamil, Tatar, Telugu, Thái, Thổ Nhĩ Kỳ, Thụy Điển, Tiếng Indonesia, Tiếng Ý, Trung, Trung (Phồn thể), Turkmen, Tây Ban Nha, Ukraina, Urdu, Uyghur, Uzbek, Việt, Xứ Wales, Yiddish, Yoruba, Zulu, Đan Mạch, Đức, Ả Rập, dịch ngôn ngữ.

Copyright ©2025 I Love Translation. All reserved.

E-mail: