ClosestLocaleMatcher replaces exact locales with the last registered variant (en_US / en_PT)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
- #1910 di @peepsii — chiusa senza merge
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
Direzione di ricerca
Leggi proxy/src/main/java/com/velocitypowered/proxy/util/ClosestLocaleMatcher.java e verifica come registerKnown e lookupClosest gestiscono le locale esatte e i fallback per lingua. Poi controlla la registrazione del catalogo in VelocityServer.java e la visualizzazione dei messaggi in ConnectedPlayer.java per avere il contesto. Aggiungi test per entrambi gli ordini di registrazione; il lavoro è concluso quando en_US e en_PT vengono risolte esattamente in entrambi gli ordini e il fallback continua a funzionare quando una locale esatta non è disponibile.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Expected Behavior
A registered exact locale should be retained: en_US clients should use US English and en_PT clients should use Pirate English, independently of catalogue registration order. Same-language fallback should apply when the exact locale is unavailable.
Actual Behavior
ClosestLocaleMatcher maps both locales to whichever English locale was registered last. Registering US then Pirate makes an en_US client receive Pirate translations; reversing the order makes a real en_PT client receive US English.
This can affect native messages such as velocity.kick.shutdown. The native catalogue loader uses an unsorted Files.walk, so regional-variant selection can depend on filesystem enumeration order.
Steps to Reproduce
The following standalone program uses the existing native class from the unchanged official Velocity JAR. It starts no proxy and loads no plugins.
Save as LocaleMatcherRepro.java:
import com.velocitypowered.proxy.util.ClosestLocaleMatcher;
import java.util.List;
import java.util.Locale;
public final class LocaleMatcherRepro {
public static void main(String[] args) {
Locale us = Locale.US;
Locale pirate = Locale.forLanguageTag("en-PT");
ClosestLocaleMatcher matcher = ClosestLocaleMatcher.INSTANCE;
boolean usFirst = args[0].equals("US_FIRST");
matcher.registerKnown(usFirst ? us : pirate);
matcher.registerKnown(usFirst ? pirate : us);
for (Locale requested : List.of(us, pirate)) {
System.out.println(requested.toLanguageTag() + " -> "
+ matcher.lookupClosest(requested).toLanguageTag());
}
}
}
With JDK 25 and the official velocity-4.2.0-30.jar, run each case in a fresh JVM (Unix classpath syntax):
javac --release 25 -cp velocity-4.2.0-30.jar LocaleMatcherRepro.java
java -cp velocity-4.2.0-30.jar:. LocaleMatcherRepro US_FIRST
java -cp velocity-4.2.0-30.jar:. LocaleMatcherRepro PT_FIRST
Actual first invocation:
en-US -> en-PT
en-PT -> en-PT
Actual second invocation:
en-US -> en-US
en-PT -> en-US
Expected output from both invocations:
en-US -> en-US
en-PT -> en-PT
Plugin List
None in the standalone reproduction. No backend server is involved.
Velocity Version
Reproduced with official Velocity 4.2.0 build 30, upstream commit c10b49255447694ad42c3c189d7a3f4ee3e73e5e, OpenJDK 25.0.3.
Official JAR SHA-256: 35a5596a5468a035d8a32c8de5ebb0dc6b8d8f0cc3ff5169d514aca762af8aa8.
This is a standalone class reproduction, so there is no running proxy's /velocity info output for the fixture. The latest binary has not been run. The inspected current dev/4.0.0 commit, 5e8f92b98e6870c0118dadfdff42479d680654cc, still has the byte-identical matcher source linked below.
Additional Information
Relevant upstream code:
- The base matcher keeps one locale per language and applies that mapping even to known exact locales.
- The current matcher contains the same implementation.
- Catalogue registration and player message rendering connect this mapping to native messages.
A possible minimal fix is to retain the registered exact locales and prefer an exact match before family fallback; registrations should also invalidate any affected fallback cache. This would preserve true Pirate clients and normal US clients without relying on file order.
- Lingua principale
- Java
- Stelle
- 2.3k
- Fork
- 983
- Merge medio
- 4g 14h
- PR unite (30g)
- 3
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PaperMC/Velocity
-
Add a Security PolicyForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertatype: feature
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
PaperMC/Velocity#1914 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
GS4 query handler throws on short/malformed datagrams instead of dropping themForse già presa @nezxenka l’ha presa 121 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Plugin messages silently dropped during player join when getConnectedServer() is nullForse già presa @SendableMetatype l’ha presa 30 giorni fa. Apertatype: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
type: feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
PaperMC/Velocity#1920 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
type: feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di PaperMC/Velocity
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
linagora/twake-calendar-side-service#1578 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
moneymanagerex/android-money-manager-ex#3122 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
tchiotludo/akhq#3438 ·
I maintainer di solito rispondono entro 1 giorno