luci-base: extend String.format() with named placeholder support
authorJo-Philipp Wich <redacted>
Wed, 27 May 2026 13:59:24 +0000 (15:59 +0200)
committerJo-Philipp Wich <redacted>
Thu, 28 May 2026 07:01:19 +0000 (09:01 +0200)
commita31eccfa1494e6cb8afc90963ae7081c800d25e0
treee71b71d4f76737e6714a578c88b5ffc2ab6f1618
parentf699752316ac4651ae4f4f966510d352670ca87a
luci-base: extend String.format() with named placeholder support

Support for %{key} and %{key:fmt} named placeholders in String.format().
The key is looked up in any plain-object argument passed to format(); the
argument list is scanned left-to-right and the first object containing the
key wins, allowing mixing of positional and named substitutions, e.g.:

  '%s test %{foo:s}'.format('blah', {bar: true}, {foo: 123})
     => 'blah test 123'

Ref: https://github.com/openwrt/luci/issues/8603#issuecomment-4554956879

Signed-off-by: Jo-Philipp Wich <redacted>
Co-Authored-By: Claude Sonnet 4.6 <redacted>
modules/luci-base/htdocs/luci-static/resources/cbi.js
git clone https://git.99rst.org/PROJECT