Skip to content

Instantly share code, notes, and snippets.

@sergiomichels
Created July 23, 2013 00:27
Show Gist options
  • Select an option

  • Save sergiomichels/6058890 to your computer and use it in GitHub Desktop.

Select an option

Save sergiomichels/6058890 to your computer and use it in GitHub Desktop.
Message source that you can use to get all message keys (including plugins)
// src/groovy folder
package com.wordpress.sergiosmind.i18n
import org.codehaus.groovy.grails.context.support.PluginAwareResourceBundleMessageSource
class ExposedKeysMessageSource extends PluginAwareResourceBundleMessageSource {
Set getAllKeys(Locale locale) {
Set applicationKeys = getMergedProperties(locale).getProperties().keySet()
Set pluginsKeys = getMergedPluginProperties(locale).getProperties().keySet()
Set resultSet = [] as Set
resultSet.addAll(applicationKeys)
resultSet.addAll(pluginsKeys)
return resultSet
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment