# Random string generation using Thai language

**URL:** <https://forum.robotframework.org/t/random-string-generation-using-thai-language/5141>\
**Category:** Robot Framework\
**Created:** [5 January 2023 14:54 UTC](https://forum.robotframework.org/t/random-string-generation-using-thai-language/5141 "2023-01-05T14:54:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ccma](https://avatars.discourse-cdn.com/v4/letter/c/a6a055/32.png) [@Ccma](https://forum.robotframework.org/u/Ccma)\
**Post date:** [5 January 2023 14:54 UTC](https://forum.robotframework.org/t/random-string-generation-using-thai-language/5141/1 "2023-01-05T14:54:51Z")

</div>

Hi,  
We need to generate random string in Thai language.  
Please suggest how we can achieve the same.

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [6 January 2023 03:16 UTC](https://forum.robotframework.org/t/random-string-generation-using-thai-language/5141/2 "2023-01-06T03:16:13Z")

</div>

Hi Seema,

[FakerLibrary](https://github.com/guykisel/robotframework-faker) is quite useful for this sort of thing, you just need to load it with the relevant locale, in your case Thai (th\_TH).

Here’s an example to get you started:

_Seema-0.robot_

```python
***Settings***
Library FakerLibrary	locale=th_TH

***Variables***

***Test Cases***
Random Thai Words

	${word}=	Word
	Log ${word}
	Log To Console ${word}

	${words}=	Words
	Log ${words}
	Log To Console ${words}

Random Thai Phrases

	${string}= Sentence
	Log ${string}
	Log To Console ${string}

	# didn't return Thai phrase
	${string}= Catch Phrase
	Log ${string}
	Log To Console ${string}

```

Example output

```python
% robot Seema-0.robot 
==============================================================================
Seema-0                                                                       
==============================================================================
Random Thai Words                                                     
..แต่ง
...['สมอง', 'แกะ', 'ลืมคาว']
Random Thai Words | PASS |
------------------------------------------------------------------------------
Random Thai Phrases                                                   
..เสรีภาพหน้ากากโดยเรียงสีแดงเชื้อโรค 
...Balanced multi-state database
Random Thai Phrases | PASS |
------------------------------------------------------------------------------
Seema-0 | PASS |
2 tests, 2 passed, 0 failed
==============================================================================
Output: /Users/dave/tmp/Seema/output.xml
Log: /Users/dave/tmp/Seema/log.html
Report: /Users/dave/tmp/Seema/report.html

```

Sorry, I don’t speak/read/write Thai so don’t know if these are valid words? hopefully this is what you are after 🤞🏻

Dave.
