Many writers have used dialect to portray characters whose use of non-standard English often indicates a difference in geography or social status from the protagonist.
There are many examples in literature. One of the most famous is Mark Twain’s use in The Adventures of Huckleberry Finn. An example: “Yes. You know that one-laigged n***** dat belongs to old Misto Brandish? Well, he sot up a bank, en say anybody dat put in a dollar would git fo’ dollars mo’ at de en’ er de year.”
So, how easy was that to read? Pretty tough, no? I find myself working so hard to figure out what is being said that I forget to concentrate on the meaning.
And because of that, I also lose whatever emotion intended for the passage.
By and large, I’m not a fan of using dialect for that reason alone.
Other dangers of using dialect
But there are other hazards to using dialect.
Stereotyping. You run the risk of stereotyping the culture you’re trying to portray. You can get away with this type of dialect if you’re writing about your own culture. But be very careful if you introduce ancillary characters who are not. Yes, you might be able to get across quickly who this minor character is using dialect. But I think you’d be better off either having the character speak in his own language and providing a translation in brackets immediately after or creating another character who translates for the group being addressed as well as the reader.
Cultural appropriation  is a much talked about and contentious issue right now. It is basically when the member of one culture uses/adopts aspects of another culture and, in our case, incorporates this borrowed material into a written piece. It questions to what extent, for example, a non-indigenous writer can portray an indigenous character. Or any other culture not their own.
Use of dialect can be a slippery slope into either of these two phenomena.
Capture the sense of the idiom
However, it also doesn’t make sense that a writer can write only about his own culture, with no contact with others’. But here is how you can portray the culture/language without resorting to dialect.
Use easily recognizable words from the language. There are often words in your character’s native culture that are recognizable to English readers. Sayonara or Arigatō from Japanese. If you think the reader might not know the word, the dialogue can always be something like: I am most grateful. Arigatō.
Use grammatical errors. Prepositions are tough to get right in any language. German people speaking English might say “I am interested for” rather than ‘in.’ Or “I took an aspirin against a headache” rather than ‘for.’
Use the cadence of language. In French, débit is the flow of the spoken word. If you know French, you will soon pick up the particular rhythm that Francophones use, particularly with other native French speakers. You can mimic this pace and tempo in your dialogue to give the impression of a Francophone even if the speech is entirely in English.
If you don’t know the culture well enough to use one of these techniques, why are you trying to portray a character from that background? Just asking.
Anyhow, both for ease of reading and to avoid straying inadvertently into controversial territory, stick as closely to standard English as you can, making adjustments at the margins to add flavor.