You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:10:08 UTC

[sling-org-apache-sling-scripting-sightly-compiler] 04/15: SLING-5314 - Support setting the basename for the resource bundle backing the Sightly i18n Extension

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.scripting.sightly.compiler-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-compiler.git

commit 1154ba31ea8c00464103c80c44d1be4ac4dd9143
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Tue Jul 5 12:19:16 2016 +0000

    SLING-5314 - Support setting the basename for the resource bundle backing the Sightly i18n Extension
    
    * added support for non-standard (not in the language specification) 'basename' option in expressions using 'i18n'
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly/compiler@1751458 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/scripting/sightly/compiler/RuntimeFunction.java  | 4 ++++
 .../org/apache/sling/scripting/sightly/impl/filter/I18nFilter.java    | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/scripting/sightly/compiler/RuntimeFunction.java b/src/main/java/org/apache/sling/scripting/sightly/compiler/RuntimeFunction.java
index f4fa5e0..e88022c 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/compiler/RuntimeFunction.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/compiler/RuntimeFunction.java
@@ -16,6 +16,8 @@
  ******************************************************************************/
 package org.apache.sling.scripting.sightly.compiler;
 
+import java.util.Locale;
+
 /**
  * <p>
  *     This class documents what runtime functions (abstracted by
@@ -55,6 +57,8 @@ public final class RuntimeFunction {
      *         <li>the String to translate</li>
      *         <li>optional: locale information</li>
      *         <li>optional: hint information</li>
+     *         <li>optional (not part of the specification): basename information; for more details see
+     *         {@link java.util.ResourceBundle#getBundle(String, Locale)}</li>
      *     </ol>
      * </p>
      * <p>
diff --git a/src/main/java/org/apache/sling/scripting/sightly/impl/filter/I18nFilter.java b/src/main/java/org/apache/sling/scripting/sightly/impl/filter/I18nFilter.java
index 62d5756..3fe12d5 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/impl/filter/I18nFilter.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/impl/filter/I18nFilter.java
@@ -32,6 +32,7 @@ public final class I18nFilter extends AbstractFilter {
     public static final String I18N_OPTION = "i18n";
     public static final String HINT_OPTION = "hint";
     public static final String LOCALE_OPTION = "locale";
+    public static final String BASENAME_OPTION = "basename";
 
     private static final class I18nFilterLoader {
         private static final I18nFilter INSTANCE = new I18nFilter();
@@ -55,7 +56,7 @@ public final class I18nFilter extends AbstractFilter {
             return expression;
         }
         ExpressionNode translation = new RuntimeCall(RuntimeFunction.I18N, expression.getRoot(), new MapLiteral
-                (getFilterOptions(expression, HINT_OPTION, LOCALE_OPTION)));
+                (getFilterOptions(expression, HINT_OPTION, LOCALE_OPTION, BASENAME_OPTION)));
         expression.removeOption(I18N_OPTION);
         return expression.withNode(translation);
     }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.