@@ -39,7 +39,7 @@ class I18nGrailsPlugin {
3939
4040 def doWithSpring = {
4141 // find i18n resource bundles and resolve basenames
42- def baseNames = []
42+ def baseNames = [] as Set
4343
4444 def messageResources
4545 if (application. warDeployed) {
@@ -52,20 +52,25 @@ class I18nGrailsPlugin {
5252 if (messageResources) {
5353
5454 for ( resource in messageResources) {
55- // Skip files with a locale specification, since we assume
56- // that there is an associated base resource bundle too.
57- if (resource. filename. contains(" _" )) {
58- continue
59- }
60-
6155 // Extract the file path of the file's parent directory
6256 // that comes after "grails-app/i18n".
6357 def path = StringUtils . substringAfter(resource. path, baseDir)
6458
65- // Lop off the extension - the "basenames" property in the
66- // message source cannot have entries with an extension.
67- path - = " .properties"
68-
59+ // look for an underscore in the file name (not the full path)
60+ def fileName = resource. filename
61+ def firstUnderscore = fileName. indexOf(' _' )
62+
63+ if (firstUnderscore > 0 ) {
64+ // grab everyting up to but not including
65+ // the first underscore in the file name
66+ def numberOfCharsToRemove = fileName. length() - firstUnderscore
67+ def lastCharacterToRetain = -1 * (numberOfCharsToRemove + 1 )
68+ path = path[0 .. lastCharacterToRetain]
69+ } else {
70+ // Lop off the extension - the "basenames" property in the
71+ // message source cannot have entries with an extension.
72+ path - = " .properties"
73+ }
6974 baseNames << " WEB-INF/" + baseDir + path
7075 }
7176 }
@@ -124,3 +129,4 @@ class I18nGrailsPlugin {
124129 }
125130 }
126131}
132+
0 commit comments