I will soon be pushing a fix for the spacebar propagation and also a fix for Asian word fragments!
Edit: → Fix is live now on Firefox. Chrome will take a few days.
I will soon be pushing a fix for the spacebar propagation and also a fix for Asian word fragments!
Edit: → Fix is live now on Firefox. Chrome will take a few days.
I have asked LingQ in the past to provide a button to translate every sentence in a lesson. Going through sentence mode and clicking the ‘translate’ button is really annoying. I actually prefer translations to dictionary lookups when I’m a beginner. Also, I sometimes like to use the app offline, which makes online translations impossible. At one point I hacked together a script to do this for my private lessons. I’ll include it down below, maybe someone can make use of it.
import requests
KEY = '12345'
LESSON_ID = '12345'
LANGUAGE = 'zh'
INDEX_URL = f'https://www.lingq.com/api/v3/{LANGUAGE}/lessons/{LESSON_ID}/editor/?'
TRANSLATE_URL = f'https://www.lingq.com/api/v2/{LANGUAGE}/lessons/{LESSON_ID}/sentences/'
HEADERS = {
'accept': 'application/json',
'Authorization': f"Token {KEY}",
'content-type': 'application/json'
}
def get_indexes():
response = requests.get(INDEX_URL, headers=HEADERS)
if response.status_code == 200:
data = response.json()
indexes = []
for paragraph in data.get('paragraphs', []):
for sentence in paragraph.get('sentences', []):
indexes.append(sentence.get('index'))
return indexes
else:
print(f'Error: {response.status_code}\nResponse: {response.text}')
return []
def trigger_translation(index):
data = {
'index': index,
'language': 'en',
'is_google_translate': True
}
response = requests.post(TRANSLATE_URL, headers=HEADERS, json=data)
if response.status_code == 201:
return response.text
else:
return f'Error: {response.status_code}\nResponse: {response.text}'
if __name__ == "__main__":
indexes = get_indexes()
if indexes:
for index in indexes:
translated_sentence = trigger_translation(index)
print(f'Translated Sentence for index {index}: {translated_sentence}')
Thank you for the script @bamboozled. I’ll actually make this extension tonight! Then I can incorporate the auto translation into Rooster Reader. I Would probably limit it to say 100 sentences? I’m not sure they would want large text translations. I could probably make it auto save the translation and just reuse it.
I made this for my private lessons, you would have to get the sentence index from another url. I tried it on one of the new 6k word lessons and it does take some time but I got it all translated. Not completely sure what happens when a translation already exists, it might get replaced? You might need to try around a bit.
This is the approach I have been using in javascript to do it dynamically.
if (window.location.href.match(/https:\/\/www\.lingq\.com\/[a-z]{2}(-[a-z]{2})?\/learn\/[a-z]{2}(-[a-z]{2})?\/web\/reader\/\d+/)) {
//console.log("Matched URL, creating GUI menu");
urlParts = window.location.pathname.split('/');
inLanguage = urlParts[1]; // Get the translation language code (e.g., 'en')
language = urlParts[3]; // Get the language code (e.g., 'fi')
lessonId = urlParts[6]; // Get the lesson ID (e.g., '23017594')
}
I’m sure LingQ probably knew about your 600 requests in a row as well XD
I’m considering a hard throttle, like 1 sentence gets translated, wait 1 second, ask for the next. (That would at least mimic someone spamming the next button in sentence view). Let’s see how this goes!
I’m in deep. I’ll figure it out
Word Fragments! Especially welcome for Korean!!
(Korean word particles are a doozy).
More updates coming for Rooster Observer soon!
Great to hear. I was testing it out in Korean to try replicate your problem and the fragments were all saying ‘null’. I’ve fixed most… languages but there could still be outliers.
Automatic Lesson Translator Community Version has just been released. Please leave me feedback regarding upper use limits.
Woah, I need to check this out! Word fragments for Korean! I second WillowMeDown!
This is awesome! And exciting!
Is this under the Rooster Observer extension?
Check it out!
Manual Installation via Firefox (for quick access):
To install an extension temporarily:
- open Firefox
- enter “
about:debugging
” in the URL bar- click “This Firefox”
- click “Load Temporary Add-on”
- open the extension’s directory and select any file inside the extension,
or select the packaged extension (.zip file).
The extension installs and remains installed until you remove it or restart Firefox.
Source: Temporary installation in Firefox | Firefox Extension Workshop
Video provided by Firefox:
Note: After be sure to follow @roosterburton instructions for enabling the extension—if needed—mine automatically gave permission:
I would have to setup a Linux VM and investigate. Have you tried manual install from the source code and other browsers on your linux OS? Also can you tell me if there are any script errors showing up in the console?
Good stuff. Yomichan is an awesome addon, wish there was more like it.
Not sure, probably some unintended interaction. If it happens again send me over the error
I use Safari. Any plans to develop this extension for Safari? (If not, please let me know why – I may be able to help if there’s a problem.)
I don’t own a MAC, I couldn’t test or deploy the extension.
Pro tip: If the extension has already been updated for the day (or recently) and you’re not seeing updates you should be seeing. Uninstall and reinstall the extension to get the most recent update (as soon as @roosterburton announces an update since updates are always quick and frequent—when needed with all their extensions).
You’ll most likely have to re-customize the add-on to your needs again—depending on the extension (like with the Rooster Hotkeys extension)—but sometimes, getting the most recent update quicker is worth it—in my opinion.
Otherwise, just wait until it updates on its own with your automatic updates setting shown by roosterburton.
INSTRUCTIONS FOR CHROME
First download the ‘Source Code’ from the links provided on the support pages.Type this URL on Chrome → chrome://extensions/
Click this button
Navigate to the folder you downloaded and click ‘Select Folder’
Enable extension
Some additional images/instructions for Chrome users:
1. Toggle on “Developer Mode”:
2. Click “Load unpacked” and click on the unzipped file version of the extension:
Note: This is what I had to do for my first time manually installing something on the Chrome browser. I thought I would share these extra tips and images!
Feature I would appreciate:
Basically Language Reactor directly connected to LingQ.
I wish I could just watch videos on youtube and LingQ words from the subtitles directly there instead of needing to go to the LingQ website and use the reader. As the LingQ video player isn’t good I have to watch a youtube video on one half of the screen and do the LingQing on the other half and this is a slow process. Thanks for your hard work
Basically Language Reactor directly connected to LingQ.
I had not heard of Language Reactor but it looks like a very capable tool. Have a look at the results that are returned from a simple word search.
This is a query on Language Reactor for Finnish-English (using word jääkaappi)
https://lb.dioco.io/base_dict_getFullDict_6?form=jääkaappi&lemma=&sl=fi&tl=en
I will look at incorporating this info directly into my AutoLingQ feature. (using the ChatGPT form / Highest confidence ms_form result.)
I wish I could just watch videos on youtube and LingQ words from the subtitles directly there
This is possible, I’ll add it to the dev list.
I’ve added Language Reactor AutoLingQing to Master LingQ Premium from version 1.63.
That tip was very beneficial for my software and personal learning.
Send me a message with your google e-mail address and I’ll give you free access to Master LingQ Premium
ROOSTER MASTER LINGQ PREMIUM PATCH 1.63 Added Language Reactor as a Auto LingQ Method. (This method fetches gpt/machine learning results for each queried word and applies the highest confidence result. Also applies grammar tags. [image] [image] ROOSTER MASTER LINGQ PREMIUM PATCH 1.50 A patch that deserves its own post. Google Translate has been added as an alternative translation source. This method opens the google translate webpage in a new tab and continuously posts your lesson text one…