Created
July 23, 2013 16:18
-
-
Save sergiomichels/6063757 to your computer and use it in GitHub Desktop.
Update for ExposedKeysMessageSource, returning all PropertiesHolder to be used in the i18n javascript messages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.wordpress.sergiosmind.i18n | |
| import java.util.List; | |
| import java.util.Locale; | |
| import java.util.Map; | |
| import java.util.Properties; | |
| import java.util.concurrent.ConcurrentHashMap; | |
| import org.codehaus.groovy.grails.context.support.PluginAwareResourceBundleMessageSource | |
| import org.codehaus.groovy.grails.plugins.BinaryGrailsPlugin; | |
| import org.codehaus.groovy.grails.plugins.GrailsPlugin; | |
| import org.springframework.context.support.ReloadableResourceBundleMessageSource.PropertiesHolder | |
| class ExposedKeysMessageSource extends PluginAwareResourceBundleMessageSource { | |
| public Set getAllKeys(Locale locale) { | |
| PropertiesHolder pluginProps = getMergedPluginProperties(locale) | |
| Set pluginSet = pluginProps.getProperties().keySet() | |
| PropertiesHolder props = getMergedProperties(locale) | |
| Set propsSet = props.getProperties().keySet() | |
| Set returnSet = [] as Set | |
| returnSet.addAll(propsSet) | |
| returnSet.addAll(pluginSet) | |
| return returnSet | |
| } | |
| public List<PropertiesHolder> getAllProperties(Locale locale) { | |
| List<PropertiesHolder> holders = [] | |
| holders << getMergedProperties(locale) | |
| holders << getMergedPluginProperties(locale) | |
| holders | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment