How do I change the language in jFairy text objects?

I am new to using jFairy. I have tried to produce 100 English words through the following code:

for(int i=0; i<100; i++)
{          

   System.out.println(Fairy.create(Locale.ENGLISH).text().word());
   System.out.println("-----------------------");

}

      

and the outputs were like this (they were all LATINS):

vitae massa at
-----------------------
dolor lorem sed
-----------------------
posuere praesent at
-----------------------
nec metus dolor
-----------------------
aliquet purus magna
-----------------------

      

How do I get English words instead of Latin?

+3


source to share


3 answers


I've added this feature. Please check release-0.3.1 out.

Use the methods text()

, word()

, sentence()

, and paragraph()

to provide localized text and methods loremIpsum()

, latinWord()

and latinSentence()

for the Latin text.



When updating the version, also note that the groupId has changed from org.jfairy

to io.codearte.jfairy

.

+3


source


What if you are using this?



 System.out.println(Fairy.create(Locale.forLanguageTag("en")).text().word());

      

+2


source


This is already implemented in version 0.3.1 - see OlgaMaciaszek's answer

Actually jFairy text generator has the ability to generate random Lorem ipsum text .

Replacing meaningful content that can distract the placeholder text can allow viewers to focus on graphical aspects such as font, typography, and page layout. It also reduces the need for a designer to create meaningful text, as they can instead use the hastily generated lorem ipsum text.

But you're right, we have to add support for localized content to the text generator.

+1


source







All Articles