Solr
  1. Solr
  2. SOLR-8128

Current locale not set on LocaleConfig-based Velocity tools

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.4, 6.0
    • Component/s: None
    • Labels:
      None

      Description

      The locale feature of VelocityResponseWriter is currently used to set the locale for the $resource tool. However, there are some other tools that leverage the locale setting that are falling back to the default system locale.

      For example, $number.format should allow $number.format("integer",50000) to render the number in the v.locale specified locale but always uses the default system locale.

      A workaround for number formatting is to use the $resource.locale setting like this: $number.format("integer",50000,$resource.locale)

      1. SOLR-8128.patch
        6 kB
        Erik Hatcher

        Activity

        Hide
        Erik Hatcher added a comment - - edited

        Here's a patch that configures the built-in $math, $number, and $display tools with the specified locale (via v.locale); all of these are Velocity LocaleConfig extending classes. This patch also configures any custom tools that extend LocaleConfig too. Also, $resource (SolrVelocityResourceTool) was refactored to have its locale configured similarly, now that I understand how LocaleConfig works.

        Show
        Erik Hatcher added a comment - - edited Here's a patch that configures the built-in $math, $number, and $display tools with the specified locale (via v.locale); all of these are Velocity LocaleConfig extending classes. This patch also configures any custom tools that extend LocaleConfig too. Also, $resource (SolrVelocityResourceTool) was refactored to have its locale configured similarly, now that I understand how LocaleConfig works.
        Hide
        ASF subversion and git services added a comment -

        Commit 1708406 from Erik Hatcher in branch 'dev/trunk'
        [ https://svn.apache.org/r1708406 ]

        SOLR-8128: Set v.locale specified locale for all LocaleConfig extending VelocityResponseWriter tools

        Show
        ASF subversion and git services added a comment - Commit 1708406 from Erik Hatcher in branch 'dev/trunk' [ https://svn.apache.org/r1708406 ] SOLR-8128 : Set v.locale specified locale for all LocaleConfig extending VelocityResponseWriter tools
        Hide
        ASF subversion and git services added a comment -

        Commit 1708409 from Erik Hatcher in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1708409 ]

        SOLR-8128: Set v.locale specified locale for all LocaleConfig extending VelocityResponseWriter tools (merged from trunk r1708406)

        Show
        ASF subversion and git services added a comment - Commit 1708409 from Erik Hatcher in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1708409 ] SOLR-8128 : Set v.locale specified locale for all LocaleConfig extending VelocityResponseWriter tools (merged from trunk r1708406)

          People

          • Assignee:
            Erik Hatcher
            Reporter:
            Erik Hatcher
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development