diff --git a/src/FootnoteBodyFormatter.php b/src/FootnoteBodyFormatter.php index a5ed94f85..81176584b 100644 --- a/src/FootnoteBodyFormatter.php +++ b/src/FootnoteBodyFormatter.php @@ -235,11 +235,13 @@ class FootnoteBodyFormatter { int $offset, int $max ) : string { - $scope = strlen( $max ); - $ret = MediaWikiServices::getInstance()->getContentLanguage()->formatNum( - $base . '.' . sprintf( "%0{$scope}s", $offset ) + $language = MediaWikiServices::getInstance()->getContentLanguage(); + + return $language->formatNum( + $base . + '.' . + str_pad( $offset, strlen( $max ), '0', STR_PAD_LEFT ) ); - return $ret; } /** diff --git a/src/FootnoteMarkFormatter.php b/src/FootnoteMarkFormatter.php index 1bf13f3b3..c6ee02188 100644 --- a/src/FootnoteMarkFormatter.php +++ b/src/FootnoteMarkFormatter.php @@ -67,7 +67,7 @@ class FootnoteMarkFormatter { } } if ( isset( $ref['extendsIndex'] ) ) { - $label .= $language->formatNum( '.' . $ref['extendsIndex'] ); + $label .= '.' . $language->formatNum( $ref['extendsIndex'], true ); } $key = $ref['name'] ?? $ref['key']; diff --git a/tests/parser/bookReferencing.txt b/tests/parser/bookReferencing.txt index cfb65b8ca..2b4e79ba5 100644 --- a/tests/parser/bookReferencing.txt +++ b/tests/parser/bookReferencing.txt @@ -35,6 +35,8 @@ wgCiteBookReferencing=true !! test T236256 - Extending the same base multiple times is fine +!! options +language=de !! config wgCiteBookReferencing=true !! wikitext diff --git a/tests/parser/citeSmokeTests.txt b/tests/parser/citeSmokeTests.txt index 46d00355f..371d5f6df 100644 --- a/tests/parser/citeSmokeTests.txt +++ b/tests/parser/citeSmokeTests.txt @@ -36,16 +36,36 @@ Smoke test for duplicated references with conflicting text !! test Smoke test for references that are reused *before* defined in the text +!! options +language=de !! wikitext + + + + + + + + + text other !! html

[1] [1] +[1] +[1] +[1] +[1] +[1] +[1] +[1] +[1] +[1]

[2]
    -
  1. 1.0 1.1 text +
  2. 1,00 1,01 1,02 1,03 1,04 1,05 1,06 1,07 1,08 1,09 1,10 text
  3. other