Bogus
Bogus copied to clipboard
Feature request: New localized data: Word(s).
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
- Is the feature something that currently cannot be done?
- To my knowledge, yes. I'm aware that the current Words() extension for the randomizer uses the WordFunctions class, and that it's english by intentional design. It does seem to return a bit more than just "words" at this stage though, source code here: https://github.com/bchavez/Bogus/blob/master/Source/Bogus/Randomizer.cs#L875
-
What alternatives have you considered? Randomizer.Words() and the lorem dataset.
-
Has the feature been requested in the past? Not to my knowledge
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.