@@ -0,0 +1,3307 @@
+/*%0A * Copyright 2010-2012 the original author or authors.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage griffon.core.i18n;%0A%0Aimport griffon.util.ConfigReader;%0Aimport griffon.util.Environment;%0Aimport griffon.util.GriffonApplicationUtils;%0Aimport griffon.util.Metadata;%0Aimport groovy.lang.Script;%0Aimport groovy.util.ConfigObject;%0A%0Aimport java.net.URL;%0Aimport java.util.*;%0A%0Aimport static griffon.util.ConfigUtils.getConfigValue;%0A%0A/**%0A * @author Andres Almiray%0A * @since 1.1.0%0A */%0Apublic class GroovyScriptResourceBundle extends ResourceBundle %7B%0A    private final ConfigObject config;%0A    private final List%3CString%3E keys = new ArrayList%3CString%3E();%0A%0A    public GroovyScriptResourceBundle(URL location) %7B%0A        this(null, location);%0A    %7D%0A%0A    public GroovyScriptResourceBundle(Script script) %7B%0A        this(null, script);%0A    %7D%0A%0A    public GroovyScriptResourceBundle(String script) %7B%0A        this(null, script);%0A    %7D%0A%0A    public GroovyScriptResourceBundle(Class scriptClass) %7B%0A        this(null, scriptClass);%0A    %7D%0A%0A    public GroovyScriptResourceBundle(ConfigReader reader, URL location) %7B%0A        this(resolveConfigReader(reader).parse(location));%0A    %7D%0A%0A%0A    public GroovyScriptResourceBundle(ConfigReader reader, Script script) %7B%0A        this(resolveConfigReader(reader).parse(script));%0A    %7D%0A%0A    public GroovyScriptResourceBundle(ConfigReader reader, String script) %7B%0A        this(resolveConfigReader(reader).parse(script));%0A    %7D%0A%0A    public GroovyScriptResourceBundle(ConfigReader reader, Class scriptClass) %7B%0A        this(resolveConfigReader(reader).parse(scriptClass));%0A    %7D%0A%0A    private static ConfigReader resolveConfigReader(ConfigReader reader) %7B%0A        if (null != reader) return reader;%0A        reader = new ConfigReader();%0A        reader.registerConditionalBlock(%22environments%22, Environment.getCurrent().getName());%0A        reader.registerConditionalBlock(%22projects%22, Metadata.getCurrent().getApplicationName());%0A        reader.registerConditionalBlock(%22platforms%22, GriffonApplicationUtils.getFullPlatform());%0A        return reader;%0A    %7D%0A%0A    private GroovyScriptResourceBundle(ConfigObject config) %7B%0A        this.config = config;%0A        keys.addAll(this.config.flatten(new LinkedHashMap()).keySet());%0A    %7D%0A%0A    protected Object handleGetObject(String key) %7B%0A        Object value = getConfigValue(config, key, null);%0A        return null == value ? null : String.valueOf(value);%0A    %7D%0A%0A    public Enumeration%3CString%3E getKeys() %7B%0A        final Iterator%3CString%3E keysIterator = keys.iterator();%0A        return new Enumeration%3CString%3E() %7B%0A            public boolean hasMoreElements() %7B%0A                return keysIterator.hasNext();%0A            %7D%0A%0A            public String nextElement() %7B%0A                return keysIterator.next();%0A            %7D%0A        %7D;%0A    %7D%0A%7D%0A

Add a ConfigObject backed ResourceBundle implementation