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

German Language Support #125

Closed
4 tasks done
jokroese opened this issue Jan 25, 2023 · 3 comments
Closed
4 tasks done

German Language Support #125

jokroese opened this issue Jan 25, 2023 · 3 comments
Labels
👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on

Comments

@jokroese
Copy link

Initial checklist

Problem

I am supporting a colleague's project to build a browser plugin for encouraging gender-neutral language in German. I was really happy to find retext-equality and think it could be a brilliant base for some of the functionality.

I want to support my colleague in adding German language to retext-equality. (Some of the contributors won't be familiar with programming and I don't speak German.) I have seen that there are similar approaches to support retext-profanities (get-alex/alex#212). I also found a relevant issue here which ended with @wooorm refactoring the code to support multiple languages (#59). This is great!

I've started following the suggestions in #59 (comment) by adding a couple of basic rules and I am now trying to add the tests. I have a few questions about the best way to do this as it will form the template for both German and adding other languages.

Solution

  1. Should I follow the approach taken in retext-profanities and export retextEqualityDe from de.js?

  2. How should I set up tests?

I'm not super familiar with writing tests in Javascript but it looks simple enough. That said, I would like some support in creating a template for testing non-English language patterns in retext-equality.

The main reference I have found is that retext-profanities has the following test (https://github.com/retextjs/retext-profanities/blob/main/test.js#L35):

const fileFr = await retext().use(retextProfanitiesFrench).process('Merde!')

  assert.deepEqual(
    fileFr.messages.map(String),
    ['1:1-1:6: Don’t use `Merde`, it’s profane'],
    'should support other languages'
  )

This only runs for one test, whereas in retext-equality there are many tests for English.

Could someone give me an example of how a good template for the non-English tests would look?

Alternatives

I could intuitively push forward or not put in tests but I don't think either are good ideas!

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Jan 25, 2023
@wooorm
Copy link
Member

wooorm commented Jan 26, 2023

Hi Joe!

When you add patterns in data/de/*, the scripts should do the rest. See https://github.com/retextjs/retext-equality/blob/main/script/generate.js. Run npm test to check everything.
So that should do Q1.

For Q2, maybe free make a PR with the data, then I can advise a test for that? Though, what you have for french in retext-profanities, is very similar to what I’d suggest. You don’t have to be exhaustive, a couple of tests should be enough!

@wooorm
Copy link
Member

wooorm commented Sep 19, 2024

Closing for now: translations are welcome — a tracking issue for german in particular is not needed (discussions are a good place for anyone who wants to do the work)

@wooorm wooorm closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2024
@wooorm wooorm added the 👀 no/external This makes more sense somewhere else label Sep 19, 2024

This comment has been minimized.

@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

2 participants