API Language Field Validation Prevents Locale-Specific Language Selection #535

Closed
opened 2026-02-05 17:44:40 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @Dong-Chen-1031 on GitHub (Jan 3, 2026).

Originally assigned to: @Boy132 on GitHub.

Current Behavior

When creating users via the API at POST /api/application/users, the language field validation only accepts 2-letter ISO 639-1 language codes (e.g., zh, en, fr).

This prevents users from specifying locale-specific language codes like zh-TW (Traditional Chinese - Taiwan), pt-BR (Brazilian Portuguese), or ar-SA (Saudi Arabic) even though the system has complete translation files for these locales.

When Debug=false :

{
  "errors": [
    {
      "code": "ValidationException",
      "status": "422",
      "detail": "The selected language is invalid.",
      "meta": {
        "source_field": "language",
        "rule": "in"
      }
    }
  ]
}

When Debug=true : pelican_respond.json

Expected Behavior

The API should accept locale codes in the format xx-XX (language-country) in addition to 2-letter language codes, matching the existing translation file structure in the lang/directory.

Steps to Reproduce

Attempt to create a user via API with language: "zh-TW"

curl -X POST "https://demo.pelican.dev/api/application/users" \
  -H "Authorization: Bearer your_api_key_identifier_token" \
  -H "Accept: application/vnd.panel.v1+json" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "username": "testuser",
    "language": "zh-TW"
  }'

Request fails validation because zh-TW contains a hyphen and country code

Panel Version

1.0.0-beta30

Wings Version

1.0.0-beta21

Games and/or Eggs Affected

No response

Docker Image

No response

Error Logs


Is there an existing issue for this?

  • I have searched the existing issues before opening this issue.
  • I have provided all relevant details, including the specific game and Docker images I am using if this issue is related to running a server.
  • I have checked in the Discord server and believe this is a bug with the software, and not a configuration issue with my specific system.
Originally created by @Dong-Chen-1031 on GitHub (Jan 3, 2026). Originally assigned to: @Boy132 on GitHub. ### Current Behavior When creating users via the API at POST /api/application/users, the language field validation only accepts 2-letter ISO 639-1 language codes (e.g., `zh`, `en`, `fr`). This prevents users from specifying locale-specific language codes like `zh-TW` (Traditional Chinese - Taiwan), `pt-BR` (Brazilian Portuguese), or `ar-SA` (Saudi Arabic) even though the system has complete translation files for these locales. When Debug=false : ```json { "errors": [ { "code": "ValidationException", "status": "422", "detail": "The selected language is invalid.", "meta": { "source_field": "language", "rule": "in" } } ] } ``` When Debug=true : [pelican_respond.json](https://github.com/user-attachments/files/24413999/pelican_error.json) ### Expected Behavior The API should accept locale codes in the format `xx-XX` (language-country) in addition to 2-letter language codes, matching the existing translation file structure in the `lang/directory`. ### Steps to Reproduce Attempt to create a user via API with `language: "zh-TW"` ```cmd curl -X POST "https://demo.pelican.dev/api/application/users" \ -H "Authorization: Bearer your_api_key_identifier_token" \ -H "Accept: application/vnd.panel.v1+json" \ -H "Content-Type: application/json" \ -d '{ "email": "user@example.com", "username": "testuser", "language": "zh-TW" }' ``` Request fails validation because `zh-TW` contains a hyphen and country code ### Panel Version 1.0.0-beta30 ### Wings Version 1.0.0-beta21 ### Games and/or Eggs Affected _No response_ ### Docker Image _No response_ ### Error Logs ```bash ``` ### Is there an existing issue for this? - [x] I have searched the existing issues before opening this issue. - [x] I have provided all relevant details, including the specific game and Docker images I am using if this issue is related to running a server. - [x] I have checked in the Discord server and believe this is a bug with the software, and not a configuration issue with my specific system.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/panel-pelican-dev#535