Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email addresses are unknown on fakerHE in Hebrew #2776

Closed
9 of 10 tasks
mordi9 opened this issue Mar 31, 2024 · 1 comment · Fixed by #2781
Closed
9 of 10 tasks

Email addresses are unknown on fakerHE in Hebrew #2776

mordi9 opened this issue Mar 31, 2024 · 1 comment · Fixed by #2781
Assignees
Labels
c: bug Something isn't working m: internet Something is referring to the internet module p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug
Milestone

Comments

@mordi9
Copy link
Contributor

mordi9 commented Mar 31, 2024

Pre-Checks

Describe the bug

When using faker.internet.email() with fakerHE, unknown email addresses are obtained, consisting of random characters. For example:

Suggested solution:
Add support for names in email addresses using simple pronunciation-hyphenation translation, which will allow creating more correct email addresses, even if the translation is not accurate.

Advantages:
Creating more realistic email addresses.
Improving the usability of fakerHE for Hebrew users.
effect:
This change will affect all fakerHE users who use faker.internet.email() to create Hebrew email addresses.

Code to create a translation using according to pronunciation


const hebrewAlphabet = {
  "א": "a",
  "ב": "b",
  "ג": "g",
  "ד": "d",
  "ה": "h",
  "ו": "v",
  "ז": "z",
  "ח": "ch",
  "ט": "t",
  "י": "y",
  "כ": "k",
  "ך": "kh",
  "ל": "l",
  "ם": "m",
  "מ": "m",
  "ן": "n",
  "נ": "n",
  "ס": "s",
  "ע": "a",
  "פ": "f",
  "ף": "ph",
  "צ": "ts",
  "ץ": "ts",
  "ק": "k",
  "ר": "r",
  "ש": "sh",
  "ת": "t",
  "ו": "v",
};

function pronounce(word) {
  let pronouncedWord = "";
  for (let i = 0; i < word.length; i++) {
    pronouncedWord += hebrewAlphabet[word[i]];
  }
  return pronouncedWord;
}

function translate(text) {
  const words = text.split(" ");
  const translatedWords = words.map(word => pronounce(word));
  return translatedWords.join(" ");
}

translate(inputText);

Minimal reproduction code

const { fakerHE: faker } = require('@faker-js/faker');
const contacts = [];
for (let i = 0; i < 10; i++) {
    contacts.push({
      name: faker.person.fullName(),
      email: faker.internet.email(),
      phone: faker.phone.number(),
      location: faker.location.street() + " "  + faker.location.buildingNumber() + " " + faker.location.city()
    });
}

Additional Context

No response

Environment Info

node.js v18.16.0

Which module system do you use?

  • CJS
  • ESM

Used Package Manager

npm

@mordi9 mordi9 added c: bug Something isn't working s: pending triage Pending Triage labels Mar 31, 2024
@ST-DDT
Copy link
Member

ST-DDT commented Mar 31, 2024

FFR:

The username method uses a charMapping that you could extend for HE.

Contributions welcome.

@ST-DDT ST-DDT added p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug m: internet Something is referring to the internet module and removed s: pending triage Pending Triage labels Mar 31, 2024
@ST-DDT ST-DDT added this to the vAnytime milestone Mar 31, 2024
@ST-DDT ST-DDT linked a pull request Apr 1, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: bug Something isn't working m: internet Something is referring to the internet module p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants