bchavez / bchavez/Bogus

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

Open
#509 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
9.7k
Forks
538
PR merge metrics
No merged PRs in 30d

Description

### 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("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.

Contributor guide

Open the contributing guide

Research direction

Start with the Words and WordsArray implementation in Source/Bogus/Randomizer.cs and the WordFunctions class referenced in the issue. Determine how Faker culture should select localized word data and what public, free dictionaries can support the feature. Done means localized words can be generated for supported cultures such as nb_NO, with the data scope and culture behavior agreed.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.