https://www.duolingo.com/arekolek

Quick language switching - userscript - update

I've made some improvements to the script by andrewmof. Here's the original thread.

The script now keeps track of the languages you use, so at first there won't be any difference.

start

Let's say you want to learn Italian from Spanish, so as usual you click "Add a new course", select "I speak Spanish", click on Italian, then "Switch to course".

From now on, you can choose between learning from English or from Spanish.

Only languages you are learning will be displayed. Notice that everything is in Spanish now.

spanish

You can quickly switch back to any of your English-based courses. Or you can add a new course like before and have it remembered for you.

eng

If you like it, get it on github

December 22, 2014

91 Comments


https://www.duolingo.com/ESCDritero

Hi, this userscript is amazing but I would like to say one thing. When I want to sample an upcoming course for example Romanian, I would try the English for Romanian speakers tree for a couple of lessons but then leave it. However, as soon as I add the tree, it gets added to the list of my courses even if I reset the progress for the English for Romanian speakers tree (since I can't delete a course if I am only taking that course for that language) so it is stuck there and I can't do anything to remove it.

Is there a way you can update the code so we are either able to delete courses from our lists? I was thinking maybe make it so the courses only show up in the list if you have at least 10 XP (or one lesson completed) so then if you reset your progress, it goes down to 0 XP therefore not showing the course in the list. Of course you don't have to that if you don't desire so, but that is just a suggestion. Thank you. :)

June 21, 2016

https://www.duolingo.com/arekolek

I myself have a couple of courses with 0 XP which I do want to show up in the list, as if they are in a queue. Hiding such courses would break the script for anybody that uses it in this way.

Maybe I could enable the "Remove" button on the settings/reset_lang page and remove the language from the script if a user clicks it. But this could take a while.

In the meantime, you can edit the userscript and change the line:

var courses = JSON.parse(GM_getValue('dcs_courses', '{}'));

to:

var courses = JSON.parse(prompt("Modify your language list:", GM_getValue('dcs_courses', '{}')));

After you refresh Duolingo and hover the flag, a prompt will let you edit your language list.

After you are done making changes, you should reinstall the script to make sure that you receive future updates.

June 22, 2016

https://www.duolingo.com/ESCDritero

Thank you so much!

June 22, 2016

https://www.duolingo.com/iamsetsetiam

I just installed your script which is working great! Thanks and some lingots for you for the help. What the heck do people do with these lingots anyway? I already have a few hundred and keep getting more.

April 27, 2017

https://www.duolingo.com/LadyOra

I have over 5000. And, well, pretty much nothing to do with them. In the app you can at least buy some silly outfits for Duo, in the web version not even that... I mean, yes, I do use streak freeze once in a while (but seldom), there's the extended language quiz that you want even less often, so... they should really add some point for the currency. :)

April 28, 2017

https://www.duolingo.com/starboystellan

ho somone gave you 795 lingots!

May 2, 2017

https://www.duolingo.com/jrikhal

@all: This could be a solution for you in case the script isn't working anymore for you after your account has been switched to the [new webversion](https://www.duolingo.com/comment/22240575 .

April 30, 2017

https://www.duolingo.com/Thomas.Heiss

@all @arekolek

I have an idea about a new course filter for the (add language list) to be working with selected multiple 2-3+ languages so I added my suggestion and detail explanation to Jrikhal's "course switcher EN user script": https://forum.duolingo.com/comment/22412321$comment_id=29110951

Please have a look and vote if you like it and you would like to see something like this.

@all
Is anyone of you interested in seeing a new feature like this?

October 3, 2018

https://www.duolingo.com/Ronnie-JA

Any plans to add this as an app in the Google webstore?

December 23, 2014

https://www.duolingo.com/jrikhal

Hi arekolek,

FYI, the script doesn't run anymore under the new version of the website (to which Duo is switching everyone little by little).
Note: I have the latest version of the script : 0.8.2

April 28, 2017

https://www.duolingo.com/sbeecroft

My favorite Duolingo script!

July 28, 2016

https://www.duolingo.com/LadyOra

Excellent script - I've been happily using it for some time now. Bud I do have a suggestion for a tweak that would make it even better. Could you also add an option for different settings profiles for different base languages?

For example, I'm learning German, and I'm also using the English for German speakers course. But in that course, I really don't need the "write down what you hear" exercises, because they only practice English, not German. So I turn off the speakers in settings, and thus such exercises don't pop up. However, when I go back to my German for English speakers, I have to go into options again and turn the sound back on so I'd be getting "write down what you hear" (and audio in general) in German, where I do need it. And since I generally switch several times per day (with much more ease thanks to your script), the possibility to have different settings would speed up the process even further. :)

July 20, 2015

https://www.duolingo.com/johnlvs2run

Great idea. I do the same thing, and would like this as well.

July 20, 2015

https://www.duolingo.com/JacobPast177

Yes, this addition would be greatly appreciated.

December 9, 2016

https://www.duolingo.com/Katzenperson

Hello, I was wondering if you would update your script to run on the new Duolingo website. I was recently upgraded, and the Course Switcher no longer works.

Someone is working on a script that covers all languages, including those you are not studying or even know how to read. But I like the Switcher that you wrote, that only includes the languages that you have enrolled in.

I hope you will find time to update your wonderful marvelous script because I surely do miss it.

May 3, 2017

https://www.duolingo.com/jrikhal

See arekolek's answer to that on the script's page.

May 5, 2017

https://www.duolingo.com/arekolek

Thank you for the kind words! I was actually working on an update last weekend. But I just found out that Duolingo now supports this feature by default https://www.duolingo.com/comment/23161515

I'm thinking there's not much use for this script anymore, is there?

June 22, 2017

https://www.duolingo.com/Kajo76

Of course there is! Look at jrikhal's posting under mine (right now: at the bottom of the page).

June 22, 2017

https://www.duolingo.com/iamsetsetiam

You are right - that switcher feature is now built into the website. I had not noticed that - thanks. Any chance that you will update your other great script - the tree trimmer? That was a very useful script until it stopped working with the new website

June 22, 2017

https://www.duolingo.com/arekolek

Yes, the tree trimmer will get an update, I guess Duolingo won't implement that feature themselves :P

June 24, 2017

https://www.duolingo.com/iamsetsetiam

Wonderful! Please let us know when it is available.

June 25, 2017

https://www.duolingo.com/coto.i
  • 1497

Of course there is! :)

Your script is much better then Duo's current implementation in terms of UX/UI. So intuitive, and no clutter at all. And knowing that Luis' promise to implement this feature needed 3 years to become reality... well, I guess they don't consider it having much importance. If you could update yours a lot of people would be grateful for sure. Please see what I wrote in the thread that you mention.

Anyway, update or not, I still want to thank you for the great switcher and for the great trimmer too.

June 27, 2017

https://www.duolingo.com/jrikhal

If I may, have a try of this similar script: not exactly the same as arekolek's (includes all courses + direct link to last WIU) but uses too the more intuitive organization "source language > target languages".
Of course, until the day (and if) arekolek's script is updated. ;)

June 27, 2017

https://www.duolingo.com/coto.i
  • 1497

Great script, jrikhal. It works very nicely as an exhaustive solution when you want to check different languages now and then. However, I would still prefer not to have all those languages there for regular use, when I really only used 2×2 (en>fr+ge, fr>en+ge) in two years of Duolingo, and will probably add 2 more (ge>en+fr) for the next two years. And I guess once I'll stop golding a tree, I might prefer not to see it anymore in the list. But will definitely not want to reset that tree as Duo team suggests as the only possibility for their current implementation.

Now, if you read what I wrote here https://www.duolingo.com/comment/23161515, your script will only need a checkbox next to every listed language (both FROM and LEARNING), to make a great interface for the ADD/REMOVE feature (to be found in Add a new course page). That would be an awesome admin/god mode of a language switcher :)

And thanks for your script too!

June 28, 2017

https://www.duolingo.com/jrikhal

your script will only need a checkbox next to every listed language (both FROM and LEARNING), to make a great interface for the ADD/REMOVE feature (to be found in Add a new course page). That would be an awesome admin/god mode of a language switcher :)

It would need to save somewhere the information of user's choice (otherwise at each reload of Duo page, you'd have to remove again): what I don't want to do/implement. Sorry. ;)

If you wonder why, two reasons:

  1. because I don't want the script to save things, to keep information (even if it'd be of course locally)
  2. but the main reason is that one of the goal of my script is exactly to push (you may say/think "force" ;) ) the visibility of all courses existing and under construction... hoping it'll help reduce the complains "I want course XXX (now)", "there are not enough courses", etc.
June 28, 2017

https://www.duolingo.com/AlmostExMonoglot

Added to the list of Duolingo Userscripts

December 23, 2014

https://www.duolingo.com/raans
  • 2017

Thanks, this is the most helpful userscript!

dd2927a3e0

December 23, 2014

https://www.duolingo.com/newbaconings

Duo should just be completely open source, to be honest. The user base seems quicker and more competent at fixing problems than the actual "team". (See also: the XP bar dilemma)

Thanks for this!

December 23, 2014

https://www.duolingo.com/guineagirl96

Is there a way to change the order that the languages are displayed in? For my "from" languages, english is farther down the list and that unfortunately is the one I have a ton of courses in (since it's my native language), so the learning menu goes off the bottom of my screen and i cant see all my courses. Thanks for any help!

July 2, 2016

https://www.duolingo.com/arekolek

Thanks for the suggestion! The "from" list is now sorted according to number of courses from that language. The "learning" sublists are now sorted according to the level you're on.

July 3, 2016

https://www.duolingo.com/guineagirl96

Wow! Thank you! Love the script by the way! Have a lingot!

July 3, 2016

https://www.duolingo.com/Lento_Rodriguez

This works great!! ¡Muchas gracias!
lentocomment course switcher

July 18, 2016

https://www.duolingo.com/CaptainCultured

Hi there! Hopefully you're still checking responses. :)

I installed the Chrome extension and download the ZIP off of Github, and I get an error from Windows saying that Line 15 has an error. Can you help me? Thanks.

October 9, 2016

https://www.duolingo.com/arekolek

That's interesting, because line 15 is actually the first line that does anything at all.

Can you maybe post a screenshot that shows the error? And also your browser version (Chrome? Chromium?), version of the extension (it's Tampermonkey?) and the version of the script you see when you view the list of userscripts in Tampermonkey?

(BTW why download ZIP? The instructions have a link that you can use for installation once you have Tampermonkey, without the need to download and unpack anything.)

October 10, 2016

https://www.duolingo.com/CaptainCultured

Yeah, I had messed up. :) It's working properly now! Thanks.

October 10, 2016

https://www.duolingo.com/arekolek

Cool, glad to hear that!

October 10, 2016

https://www.duolingo.com/CaptainCultured

Love it BTW, the easy course switcher is my favorite.

October 10, 2016

https://www.duolingo.com/Ronnie-JA

Also, I've got the script and Tampermonkey, I've enabled it but it doesn't seem to be allowing me to chose my base language (i.e. from English to French). Is there a userguide I can refer to? Either that or I'm clearly doing something wrong.

December 23, 2014

https://www.duolingo.com/arekolek

You should be able to change your base language the way you used to before installing the script.

(With the added benefit of easier switching back and forth afterwards)

December 23, 2014

https://www.duolingo.com/Ronnie-JA

That's the problem. I used the normal method to switch the base languages but I haven't seen any change when I tried to switch back (I.e. the screenshot on this page). No user guide?

December 23, 2014

https://www.duolingo.com/Ronnie-JA

Now working. I restarted my computer just to make sure, although not sure if this actually made any difference. However, maybe you can add these steps to your description above:

  • 1 - Go to 'Settings'
  • 2 - Select 'learning language'
  • 3 - Choose the target language: e.g. "Quiero aprender frances (you se espagnol)" if you wish to learn French from Spanish;
  • 4 -Your default language in the example above is now 'Spanish'.

Once this has been acheived, the other instructions you provided will allow the easy switching as the option to switch back to English now becomes available when you hover over the flag.

Works a treat. Will definitely help me to improve my languages and I've already tested out of a couple languages with some nifty switching. Muchas gracias amigo!

December 23, 2014

https://www.duolingo.com/johnlvs2run

Arekolek, thank you very much for the script, and thanks to Ronnie it is finally working. :)

May 14, 2015

https://www.duolingo.com/aminowrimo

Brilliant!

December 23, 2014

https://www.duolingo.com/prunc

Thank you! Have a Lingot!

December 29, 2014

https://www.duolingo.com/jrikhal

Hi arekolek,

First, great script!!

Any chance for levels to be shown also for courses from a language distinct from current language interface?
Meaning having the levels in your original post's last screenshot.

Maybe store it in LocalStorage too. Of course updating it any time we open or go out of the course.

February 28, 2015

https://www.duolingo.com/arekolek

Thanks for the suggestion. I've updated the script.

March 10, 2015

https://www.duolingo.com/jrikhal

Great! Thanks!!

Would it be possible for the script not to go to "www.duolingo.com" but to stay on the current page?
I tried to change my version of the script but among 1/3 of the times, it keep loading the main page. ;)

March 10, 2015

https://www.duolingo.com/arekolek

If I understand you correctly, that's a reasonable request. Check out another update.

March 10, 2015

https://www.duolingo.com/jrikhal

Does not do the trick for me.

What I mean is that if I'm on a Duo page XX (which is not "www.duolingo.com/") when I switch courses, I would like for my browser to still be on XX after having switched. When currently I end-up on the page "www.duolingo.com/" after the switch.

March 10, 2015

https://www.duolingo.com/arekolek

Verify if you have version 0.6.6 of the script installed

March 11, 2015

https://www.duolingo.com/prunc

Now it's staying on the same url when switching. Perrrrrfect! Thanks!

March 10, 2015

https://www.duolingo.com/jrikhal

I wonder why it doesn't for me... :)

March 10, 2015

https://www.duolingo.com/prunc

Try uninstall and then reinstall script.

March 11, 2015

https://www.duolingo.com/jrikhal

Already done unfortunately.

I wonder if it's not due to latency: if the "reload" in the script occurs before the core switch part (in Duo's website), which load the main page, does happen then it stay on the current page, otherwise... the core switch part took place before.

@arekolek: Does exist a function like "location.load(URL_to_load)"?
If it exists I'll test to put in a variable the current_URL at the beginning of the script then load it instead of "reload()"?

March 11, 2015

https://www.duolingo.com/prunc

Doesn't work for me anymore. I get the menu but nothing happens on click. Is it only me?

March 9, 2015

https://www.duolingo.com/arekolek

Check out the updated version. I'm not sure what the problem was, but I've moved some code around and it works now.

March 10, 2015

https://www.duolingo.com/prunc

Yes it woks now. Thank you. Have a Lingot!

March 10, 2015

https://www.duolingo.com/sbeecroft

No, Duolingo appears to have changed their site code enough to break this, so it doesn't work like before.

March 9, 2015

https://www.duolingo.com/arekolek

I've now updated the script.

March 10, 2015

https://www.duolingo.com/MikaelMello

Hey, I got an idea for a new script, could you see it? I don't know how to program and I think you might like it.

https://www.duolingo.com/comment/7849599

March 31, 2015

https://www.duolingo.com/chkube

Merci, Thank you, Danke schön, どうもありがとうございました。 Now I can learn esperanto from english, english from japanese and french from german. I gave you a Lingot.

June 22, 2015

https://www.duolingo.com/arekolek

You are welcome, I'm glad it is useful :)

June 22, 2015

https://www.duolingo.com/Rodrigo_MR.

Funciona perfectamente el script, muy útil, adiós al método tradicional tedioso... Tenga su merecido lingot buen hombre :D

April 11, 2016

https://www.duolingo.com/Glossophyle

Thank you ! I don t know how I would have managed my duolingo without this script ! To change settings every 20 minutes or worse learn all languages from the same one would be really ridiculous

April 12, 2016

https://www.duolingo.com/centime

I have only completed one lesson in my second Duolingo language. Should the second language appear in the "Learning" menu with Duolingo Course Switcher? It hasn't yet, but then, I haven't done enough lessons for the flag of my second language to appear yet.

May 6, 2016

https://www.duolingo.com/arekolek

Actually, zero lessons are needed for it to work. This is how it does work:

  1. You hover the flag next to your avatar to show the switcher. This is the moment when the script remembers all the courses of the language interface you currently see.
  2. Click "Add a new course".
  3. Select a language different than your interface language from the "I speak" dropdown.
  4. Select one of the courses in this other language and click "Switch to course".
  5. Hover the flag next to your avatar again. This time both "from" languages should be visible and contain all your courses.
May 6, 2016

https://www.duolingo.com/centime

Your instructions were very clear. The problem is that I installed the switcher after I added the new language. It seems that the switcher did not register the new language until I visited the new language again. It is working now. Thanks for the script and for helping me !

May 6, 2016

https://www.duolingo.com/jrikhal

It seems that the switcher did not register the new language until I visited the new language again.

Yes, that's how it's suppose to work: the first time (after the script is installed) you visit the course, the script will know about this course and thus add it to your list.a

May 6, 2016

https://www.duolingo.com/PapyXM

It's funny, here your script behaves the opposite of Katzenperson. I get the combo box if the current page is Discussion or Words. But it changes to standard list box if I go to the Duolingo home page or open my settings.

Combo

  • Script v0.8.2 over GreaseMonkey 3.10
  • Firefox 51.0.1 (EME Free)
  • Windows 8.1
March 2, 2017

https://www.duolingo.com/Kajo76

Your script really is awesome! Just installed the proper one and now it shows everything as expected :-)

Before I had the version 0.5.2 installed and this script hasn't done anything for me, maybe that was the old version from andrewmof, my Firefox was too old (Version 42) or I simply didn't read enough!? :-D

Thanks so much for the script! Here you've got 3 shiny, sparkling lingots :-)

October 11, 2016

https://www.duolingo.com/arekolek

Yes, 0.5.2 was andrewmof's script without my changes. Thank you.

October 11, 2016

https://www.duolingo.com/natashadusz

Rewelacja!! Wielkie dzięki! :D

October 13, 2016

https://www.duolingo.com/steven2308

Just what I was looking for. Thank you!

October 31, 2016

https://www.duolingo.com/Jon.-

Time saver dude, thanks for this!!!

December 1, 2016

https://www.duolingo.com/Katzenperson

I installed this script but it has had absolutely no effect. No change at all to the flag; still shows the same old Learning list, and no From list. I installed the script using Greasemonkey on Firefox 50.1.0 on Ubuntu 14.04 LTS.

Please help.

December 21, 2016

https://www.duolingo.com/arekolek

What languages do you use to learn other languages from (besides English)?

December 21, 2016

https://www.duolingo.com/Katzenperson

Right now, the only other language I am learning from is Spanish, which is more or less my second language.

December 21, 2016

https://www.duolingo.com/Katzenperson

Okay, I re-read this thread, esp. arekolek's instructions. I decided I would try switching to the other langauges again. This time I did it through Settings -> Learning language (or Configuración -> Idioma). Lo and behold! It all appeared as it should! From/Desde -> Learning/Aprendido. ¡Excelente! I do not why it didn't work before, but it is working now, so hurrah!

December 21, 2016

https://www.duolingo.com/Katzenperson

Oh no. The script actually isn't working properly. I thought it was okay when I saw the "FROM" menu, but not so! It will only switch language if I click on "Home" first.

If I don't click on "Home" first, when I select a language, it simply reloads the page I am already on!

This is not how it was before I installed the script. Formerly, I could switch from one language to another without having to go Home first.

December 22, 2016

https://www.duolingo.com/Katzenperson

I have been unable now to get this script to work. While it gives me the nested menus, they do not work unless you on the home page. Anyplace else, and it just reloads the page, including my profile page or settings page.

To test, I disabled the script. I went to my profile page. I switched from Spanish (from English) to Swedish (from English), and it worked. I was at the main page for Swedish.

When I re-enabled the script, I tried the same thing. I went to my profile page, and then selected a language at random. All that happened is that my profile page reloaded. My language did not switch!

Can anyone please help me! I have to keep the script disabled in the meantime because it is not working properly!

December 22, 2016

https://www.duolingo.com/Leni-L

I have a different problem: the script works for all pages but the home page, which is not very comfortable. (with FF51).

But still it is a great help. I'm just wondering why Duolingo doesn't offer this option out of the box, since it is well-known effective exercise to learn one foreign language with help from another one...

March 4, 2017

https://www.duolingo.com/PapyXM

Leni-L wrote: I have a different problem: the script works for all pages but the home page, which is not very comfortable. (with FF51).


Does it happen too when you open the Settings page of your Profil?

March 4, 2017

https://www.duolingo.com/Leni-L

Thank you for translating your question into a language I can understand :-)

It doesn't work on profile or settings pages. I assume, because the page does not completely reload while accessing these pages from the home page.

However it works fine for 'words' and 'discussion' pages.

March 4, 2017

https://www.duolingo.com/PapyXM

Yes, the same for me. Sorry for the French answer, I didn't realize I was reading in English. Huh ;-)

March 4, 2017

https://www.duolingo.com/hypershock

Will this get updated for the new site?

June 22, 2017

https://www.duolingo.com/jrikhal

There is one here. Which also includes a link to the last WIU (link automatically updated when a new one is released).

June 22, 2017

https://www.duolingo.com/Kajo76

I think it doesn't need a userscript anymore to switch languages the way we want to (except "Level 1" languages, I think).

Since Duo announced that all users are on the new website now, look at it and see for yourself, what they've done :-)

June 22, 2017

https://www.duolingo.com/jrikhal

Except if you prefer a design with one list of all source languages and when you hover over one element, it lists all the courses from that language.
Duo new design lists all courses together: when you have many courses, I find it less easy to find one course in the list than with a list+sublists organization.

June 22, 2017

https://www.duolingo.com/Kajo76

Yeah, you have a point here :-) I didn't think THIS far!

June 22, 2017

https://www.duolingo.com/hypershock

thanks. I had to change it manually once for the changes to appear

June 22, 2017
Learn a language in just 5 minutes a day. For free.