Help with !weather translation

I’m trying to build a weather command translating the parts from English to Spanish, for that I based on this post Weather to another language?
So far so good, but I wanted to go a little further and also translate the variables that the command throws, but I ran into the problem that I do not reach the characters … my question is if there is a way to use a pastebin to replace this part of the command in specific and so I can translate it in its entirety. Note: I had to omit the “at” part in the wind forecast because it gave error since it uses the word “temperatura” and modifies the “at” inside the word, I do not know if there is a way to correct this too.

$(eval '$(weather $(query))'.replace('Weather for', 'El tiempo para').replace('Conditions are', 'Las condiciones meteorológicas son').replace('with a temperature of', 'con una temperatura de').replace('The wind is blowing from the', 'La dirección del viento es').replace('and the current humidity is', 'y la humedad actual es del').replace('No location provided', 'Escribe tu ciudad/país en Inglés.'))

.replace('Fair', 'buen tiempo').replace('Snow Shower', 'nevadas').replace('Mostly', 'mayormente').replace('Clear', 'cielo despejado').replace('Cloudy', 'nublado').replace('Partly', 'parcialmente').replace('Sunny', 'soleado').replace('rain', 'lluvioso').replace('Wind', 'ventoso'))

I thank you in advance, any idea is welcome, my head exploded trying, I am noob in all this command programming, but little by little I am learning thanks to this site and to all those who share their knowledge.


I have the same issue and i’m trying to solve it

Hey @leonxnez and @snattanzi!

It seems to me your issue is mostly the lack of space to write the code, right?

To answer your question, yes, you can use Pastebin to expand your code, here’s how to do it:

$(eval w='$(weather $(query))'; $(urlfetch json

And in your paste:


Since you’ll have more room to write the code, I recommend using regex in the replace to match expressions regardless of the capitalization:

.replace(/Text tO replAce/i, 'replacing text')

Thank you a lot. This solved the issue for me. The only thing not working properly as intended for me is the “at” that leonxnez said. It gives a problem if translated. Similar to that also “and the” before “current humidity” and “is” after that “current humidity”. When i’m trying to translate those words it turns into a bug to me.

However is already cool like this, thank you a lot.

Thank you so much Emily!!! it worked perfectly! I really appreciate you helping us to solve these problems that we are facing when we have ideas to improve the user experience within the streams. :purple_heart:

1 Like

I’m not sure I understand, do you still have an issue? If so, please post your code here.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.