Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Translate: a translation into a language the page already has replaces and renames that translation; unknown codes are stored

Aperta
#612 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@guidol-ive ci sta già lavorando.

Dal 28/10/2026.

  • #613 di @guidol-ive — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
php

Direzione di ricerca

Start with textpage::translateAction() in system/datatypes/text.php:220 and Language::getIsoList(); the issue identifies the existing invalid-language message and asks for a new translation-exists message. Check how translations are stored and how the form is shown again after validation fails. Done means unknown language codes and languages already present on the page are rejected, with the form shown again; linked pull request #613 already contains a proposed implementation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Impact: Medium Level: Easy Pagetype: Text Type: Bug Value: Users Value: Visitors

The translate view of a text page offers every language except the current one, also languages in which the page already has a translation, and textpage::translateAction() saves into whatever language is posted (system/datatypes/text.php:220 has // TODO: validate that the language is a valid one).

  1. Translating into an existing language replaces that translation. hypha_setPage() finds the language, renames it to the new name, and storeWikiContent() stores the new text as its latest version. The old address of that translation gives 404, so inbound links and search results break, and the translator gets "page successfully updated" without a warning. (The old text is still in the version list.)
  2. An unknown language code is stored. A posted textLanguage=qq creates <language id="qq"> in hypha.xml. HyphaRequest only accepts codes of languages.json, so the translation can never be opened, and qq then appears in the language list of every page and in the language selector (Language::getLanguageOptionList() reads $isoLangList['qq'], which does not exist).

Steps to reproduce (fictional site, PHP 8.2 container of docs/container; nl/Over_ons has the English translation en/About_us):

  1. Log in, open nl/Over_ons/translate, choose en, name About_the_editors, any text, save.
  2. en/About_us now gives 404; en/About_the_editors has the new text.
$ curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8172/en/About_us
404

#129 mentions the dropdown ("maybe the server-side handling code will even allow them ... I haven't checked"); this issue is about the server side.

Suggested fix. In translateAction(), refuse a language that is not in Language::getIsoList() (message invalid-language, which exists) and a language the page already has (new message translation-exists), and show the form again. Leaving the existing translations out of the dropdown, or showing them separately, is part of #129. The linked pull request does the server side.

Found while checking multilingual sites. Tested in the PHP 8.2 and 8.5 containers of docs/container with a fictional test site: reproduces on main (d97ab7b), gone with the linked pull request, which is offered as a suggestion and a starting point.

🤖 Generated with Claude Code

Lingua principale
JavaScript
Stelle
5
Fork
9
Merge medio
18h 7m
PR unite (30g)
11

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PlanBCode/hypha

Tutte le issue di PlanBCode/hypha

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.