bchavez / Bogus

:card_index: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.
Other
8.51k stars 483 forks source link

Feature request: New localized data: Word(s). #509

Open olejsc opened 9 months ago

olejsc commented 9 months ago

Please describe why you are requesting a feature

The current randomizer.Words(...)is restrictred to english culture by design. The other option is the lorem ipsum dataset , but that's not really localized words.

Please provide a code example of what you are trying to achieve

using System;
using Bogus;

public class Program
{
    public static void Main()
    {
        Console.WriteLine("Hello World");
        Randomizer.Seed = new Random(8675309);

        var faker= new Faker<Something>("nb_NO") // SHOULD return norwegian words
            .RuleFor(s=> s.Name, f=> f.Random.WordsArray(1,20));
        var results = faker.Generate(100);
        foreach (var something in results){

            foreach(var word in something.Name){
                Console.WriteLine(word); //Returns english words only, from a series of english datasets
            }

        }
    }

    public class Something
    {
        public string[] Name {get; set;}
    }
}

Please answer any or all of the questions below

If the feature request is approved, would you be willing to submit a PR? It probably only makes sense to scale out with this feature when dictionairies from the most common languages are used. For me, I'd like to add norwegian words, but the use case is fairly low only for norwegian. Getting dictionairies that are public and free to use (and somewhat updated) is arguably the hardest part.

Yes / No (Help can be provided if you need assistance submitting a PR) Possibly, if I have time available.