Where are you setting the language? You would need this action in an event somewhere, with whatever conditions you want (a button press, for example). Do this before your dialogue launch event i.e. in an event above the one where dialogue is launched.
Your Yarn if-block formatting is correct (your second screenshot, not the first one) though delete the second set of closing ‘>>’ (the grey ones).
You may find this helpful: