Skip to content

Conversation

@antoinekm
Copy link

Hey @hotheadhacker,
This PR adds support for multiple languages to the api.

Changes

  • Restructuring the project to use a directory-based approach for language files
  • Moving existing English reasons to reasons/en.json
  • Adding support for the Accept-Language HTTP header
  • Implementing language detection and fallback logic
  • Adding initial support for German (de) and French (fr) translations
  • Updating documentation to include multilanguage usage

How to Test

  • Make a request with Accept-Language: de to get German rejections
  • Make a request with no language header or an unsupported language code, and verify it falls back to English

Related Issues/PR
Closes: #3, #5

Compared to PR #5, this solution offers:

  • Cleaner file organization: Each language lives in its own file, making it easy to see what's available at a glance
  • Easier contributions: Want to add Spanish? Just create es.json instead of navigating a huge JSON file
  • Fewer git conflicts: When two people work on different languages, their changes won't collide
  • Better memory usage: We only load the language file you need, not every phrase in every language
  • Industry-standard approach: Uses the same patterns as other multilingual projects
  • Simpler code: No need for complex shuffling logic or global state management

@andreulhoa
Copy link

I would like to contribute with pt-BR nopes phrases following Add multilanguage support with per-language rejection phrases #17 's implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support multilanguage nopes based on the Accept-Language standard header

3 participants