Generally, posts on SE has to be in English (with exception on some SE sites).
As long as it's in salvageable English, feel free to edit and improve it. However, avoid translating the post by yourself because:
- you might accidentally change the intent, and
- for OP who has a difficulty in English, there's a possibility that the English posts won't be helpful to them.
When you encounter non-English questions, flag/vote to close as "unclear". For non-English answer, flag as "very low quality". Also, consider commenting on the post to let OP know that the post has to be in English, and ask them to translate it to English.
For non-English code, it's allowed as long as the code is understood. Otherwise, feel free to ask for clarification like the meaning of the variable/constant/function.
Further reading: Do posts have to be in English on Stack Exchange?, How to treat English questions which have code in a foreign language?