Maybe even just white text on a black background (for light mode) and black text on white background—or cream-colored or something—(for the dark mode browser users) as long as it doesn’t mess with accessibility, since light vs. dark mode is mainly an accessibility feature.
For me, I definitely missed it because it’s so much like the LIngQ interface, but that could be a good thing overall (unobtrusive) as long as the information page for the extension has a big “obnoxious” arrow pointing to it in the preview images or something, lol.
Are you referring to the lesson updater or rooster reader premium? I think that idea would be good for both.
That’s what I was going for! Not much point if people don’t see it though. I’ll think of a different way to make it stand out (such as a shimmer or gradient on the color)
Honestly, anywhere would help new users that won’t otherwise notice the “button” as it is on any of the extensions—if they have similar “buttons”—(poor souls like me, lol—currently, I’m using the Rooster Editor only.
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.
Summary
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!
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.
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?
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.