waynecz / dadda-translate-crx

🐱 比较好看的 Chrome 划词翻译(搜狗)插件,自带生词簿及吐司弹词记忆,可与有道、扇贝单词同步
https://chrome.google.com/webstore/detail/%E7%81%AB%E5%B1%B1%E7%BF%BB%E8%AF%91-%E5%88%92%E8%AF%8D%E5%92%8C%E7%BD%91%E9%A1%B5%E7%BF%BB%E8%AF%91/klgfhbiooeogdfodpopgppeadghjjemk?hl=zh-CN
MIT License
1.65k stars 122 forks source link

How to build another language version? #9

Open vanloc0301 opened 6 years ago

vanloc0301 commented 6 years ago

I don't use Chinese as the main language. Have any method to change to another language?

Currently, I using Google Translate add-on, but it doesn't have function review history.

So, I think your plugin is the best for me.

I think you can add function to change:

translate from "language" to "another language"

That's a great idea and easy useful for many people using your add-on.

I tried to folk your repo and run:

npm install

`npm run dev

It shows look like this:

capture

I tried to find .crx file in ./releases folder, but seem this file is not generated by this command, it was created before.

How to import the addon after build success to Chrome?

Sorry, I don't have any experience with Node.js.

I only know few basic skill.

Thank you very much.

waynecz commented 6 years ago

Thank you for your feedback!!!

And 🤔emmmm..., to be honest, I didn't have any plan to support other languages at the beginning,
not only because the Sougou-translate-engine I used which is super Chinese local, it perform disappointed at "other language -> english", but the engine's API-network is not good out of Chinese mainland as well (thus you can see i didn't put an english version readme there

But, could you plz tell me your mother language?

If there has a little strong demands of other language version, I'll be happy to build a new extension for your guys(cause it must be awkward if somebody want to transform the engine in this extension, many components were couplinged with Sougou very deeply now

waynecz commented 6 years ago

Oh, the command you run will build a folder named dist, and you can load the folder in chrome://extensions page by click the LOAD UNPACKED button, it will load this extension in development mode, see more here

And, crx file was packed in chrome by PACK EXTENSION button in this page too

AntiGameZ commented 6 years ago

LZ 同学看上去母语应该是越南语。

vanloc0301 commented 6 years ago

Yes, I'm from Vietnam. I hope you add this feature in future for every language. I found you're using Sougou-translate-engine. If you can use Google Translate API it will be working.

vanloc0301 commented 6 years ago

I found at index.js have to define sougouTranslate. I check in sougou website has supported many languages include Vietnamese. So, I tried to change from to: 'zh-CHS' to vi-VN. But it is not a success.

  sougouTranslate(text) {
    const payload = {
      from: 'auto',
      to: 'vi-VN'
    }
waynecz commented 6 years ago

@vanloc0301 YES! Since the Sougou is not even a little bit good at translating other language -> english(such as Vietnamese), it only return not a standard data format which merely contain single word without oxford-dict's translations, for that the result-panel component would parse it error.

THRER WOULD BE A SOLUTION if you can format result form any-engine else's (google / cambridge...) to this construction

vanloc0301 commented 6 years ago

Hi @waynecz .

I tested Sougou also translate from English -> Vietnamese. The result looks like Google Translate. With cambridge.org, I can't access to API because it requires payment (free 30 days API evaluation key).

Currently, only have two choice is Google Translate and Sougou.

I don't have any experience with Node.js. Can you write sample code for my problem?

If you can add the new method to another language. I think your repository an inheritance and using for many purposes.

vanloc0301 commented 6 years ago

Hi @waynecz ,

Can you help me?

waynecz commented 6 years ago

Hi @vanloc0301 , sorry about reply late,

  1. The API I used was free totally, which site did you test, is the url fanyi.sougou.com ? And the UI looks like image.

  2. I cannot comprehend what problem you met exactly, but I still do not recommend use Sougou for translate languages like English -> Vietnamese. Could you specify which module of sample code do you need.

  3. Add a new method to another language will cost a lot of time for now but I will try

vanloc0301 commented 6 years ago

Hi @waynecz , thank for your response.

  1. Yes, I used: https://fanyi.sogou.com/ to test.
  2. Can you explain why don't use Sogou? I tested on Sogou and found the result look like Google Translate.
  3. Thank you very much. I will introduce your repository to my blog to many people know your repository is used. I think to add a function like a switching from the language to another language with Google API is great optional. Because it makes your extension available in all language. Of course, you can be using optional Sogou for the Chinese language.