fix(docs-i18n): accept hyphenated numeric compounds

This commit is contained in:
Peter Steinberger
2026-07-23 20:14:48 -04:00
parent 090bdab5b8
commit 0d406a84db
2 changed files with 6 additions and 3 deletions

View File

@@ -2697,8 +2697,8 @@ func TestValidateDocBodyRejectsChangedCompositeLiteral(t *testing.T) {
func TestExtractNumericValuesKeepsLowAmbiguityComposites(t *testing.T) {
t.Parallel()
got := strings.Join(extractNumericValues("0xFF 0b101 0o755 1.5:1 24/7 1e-3 v1.2.3 v24/7 24/7z"), ",")
if want := "0xFF,0b101,0o755,1.5:1,24/7,1e-3"; got != want {
got := strings.Join(extractNumericValues("0xFF 0b101 0o755 1.5:1 24/7 1e-3 v1.2.3 v24/7 24/7z Hailuo-2.3/02"), ",")
if want := "0xFF,0b101,0o755,1.5:1,24/7,1e-3,2.3/02"; got != want {
t.Fatalf("unexpected composite literals: got=%q want=%q", got, want)
}
if err := validateDocChunkTranslation("Supports 1:1 conversations.\n", "Unterstützt 1:1-Unterhaltungen.\n"); err != nil {
@@ -2707,6 +2707,9 @@ func TestExtractNumericValuesKeepsLowAmbiguityComposites(t *testing.T) {
if err := validateDocChunkTranslation("Available 24/7.\n", "24/7 उपलब्ध।\n"); err != nil {
t.Fatalf("expected translated prose around exact slash ratio to pass: %v", err)
}
if err := validateDocChunkTranslation("Hailuo 2.3/02 models.\n", "Hailuo-2.3/02-Modelle.\n"); err != nil {
t.Fatalf("expected locale hyphen compound around exact ratio to pass: %v", err)
}
}
func TestExtractNumericValuesKeepsClockCoreBeforeMeridiemSuffix(t *testing.T) {

View File

@@ -354,7 +354,7 @@ func hasCompositeNumericLeadingContinuation(text string, position int) bool {
}
return position > 0 && isCompositeNumericWordByte(text[position-1])
}
return value == '.' || value == '-' || isCompositeNumericWordByte(value)
return value == '.' || isCompositeNumericWordByte(value)
}
func hasCompositeNumericContinuation(text string, position int) bool {