Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added MessageKeyMatcher support for detecting uses of messages.getMessage function #10

Merged
merged 1 commit into from

2 participants

@oporkka

messages.getMessage can be used e.g. if you want to get messages using another locale than the one that is currently selected, for example if you want to include localized messages in two languages on the same page

@huljas huljas merged commit a7ecb15 into huljas:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 26, 2012
  1. @oporkka
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 7 deletions.
  1. +9 −7 src/play/modules/messages/MessageKeyMatcher.java
View
16 src/play/modules/messages/MessageKeyMatcher.java
@@ -12,12 +12,13 @@
*/
public class MessageKeyMatcher {
- String REGEXP1 = "\\QMessages.get(\"\\E([^\"]*)\"";
- String REGEXP2 = "\\QValidation\\E\\Q.addError(\\E[^,]*,[^\"]*[\"]([^\"]*)\"";
- String REGEXP3 = "\\Q&{\\E[']([^']*)[']";
- String REGEXP4 = "\\Qmessages\\E\\Q.get(\"\\E([^\"]*)\"";
- String REGEXP5 = "\\Qmessages\\E\\Q.get(\'\\E([^\']*)\'";
- String REGEXP6 = "\\Qi18n(\'\\E([^\']*)\'";
+ final String REGEXP1 = "\\QMessages.get(\"\\E([^\"]*)\"";
+ final String REGEXP2 = "\\QValidation\\E\\Q.addError(\\E[^,]*,[^\"]*[\"]([^\"]*)\"";
+ final String REGEXP3 = "\\Q&{\\E[']([^']*)[']";
+ final String REGEXP4 = "\\Qmessages\\E\\Q.get(\"\\E([^\"]*)\"";
+ final String REGEXP5 = "\\Qmessages\\E\\Q.get(\'\\E([^\']*)\'";
+ final String REGEXP6 = "\\Qi18n(\'\\E([^\']*)\'";
+ final String REGEXP7 = "\\Qmessages.getMessage(\\E[^,]*,[\\s]*'([^']*)'";
private List<Pattern> patterns = new ArrayList<Pattern>();
@@ -27,7 +28,8 @@ public MessageKeyMatcher() {
patterns.add(Pattern.compile(REGEXP3));
patterns.add(Pattern.compile(REGEXP4));
patterns.add(Pattern.compile(REGEXP5));
- patterns.add(Pattern.compile(REGEXP6));
+ patterns.add(Pattern.compile(REGEXP6));
+ patterns.add(Pattern.compile(REGEXP7));
}
/**
Something went wrong with that request. Please try again.