|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2018 the original author or authors. |
| 2 | + * Copyright 2002-2021 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -57,25 +57,26 @@ public abstract class MessageSourceSupport {
|
57 | 57 |
|
58 | 58 |
|
59 | 59 | /**
|
60 |
| - * Set whether to always apply the {@code MessageFormat} rules, |
61 |
| - * parsing even messages without arguments. |
62 |
| - * <p>Default is "false": Messages without arguments are by default |
63 |
| - * returned as-is, without parsing them through MessageFormat. |
64 |
| - * Set this to "true" to enforce MessageFormat for all messages, |
65 |
| - * expecting all message texts to be written with MessageFormat escaping. |
66 |
| - * <p>For example, MessageFormat expects a single quote to be escaped |
67 |
| - * as <code>"''"</code>. If your message texts are all written with such escaping, |
68 |
| - * even when not defining argument placeholders, you need to set this |
69 |
| - * flag to "true". Else, only message texts with actual arguments |
70 |
| - * are supposed to be written with MessageFormat escaping. |
| 60 | + * Set whether to always apply the {@code MessageFormat} rules, parsing even |
| 61 | + * messages without arguments. |
| 62 | + * <p>Default is {@code false}: Messages without arguments are by default |
| 63 | + * returned as-is, without parsing them through {@code MessageFormat}. |
| 64 | + * Set this to {@code true} to enforce {@code MessageFormat} for all messages, |
| 65 | + * expecting all message texts to be written with {@code MessageFormat} escaping. |
| 66 | + * <p>For example, {@code MessageFormat} expects a single quote to be escaped |
| 67 | + * as two adjacent single quotes ({@code "''"}). If your message texts are all |
| 68 | + * written with such escaping, even when not defining argument placeholders, |
| 69 | + * you need to set this flag to {@code true}. Otherwise, only message texts |
| 70 | + * with actual arguments are supposed to be written with {@code MessageFormat} |
| 71 | + * escaping. |
71 | 72 | * @see java.text.MessageFormat
|
72 | 73 | */
|
73 | 74 | public void setAlwaysUseMessageFormat(boolean alwaysUseMessageFormat) {
|
74 | 75 | this.alwaysUseMessageFormat = alwaysUseMessageFormat;
|
75 | 76 | }
|
76 | 77 |
|
77 | 78 | /**
|
78 |
| - * Return whether to always apply the MessageFormat rules, parsing even |
| 79 | + * Return whether to always apply the {@code MessageFormat} rules, parsing even |
79 | 80 | * messages without arguments.
|
80 | 81 | */
|
81 | 82 | protected boolean isAlwaysUseMessageFormat() {
|
@@ -150,10 +151,10 @@ protected String formatMessage(String msg, @Nullable Object[] args, Locale local
|
150 | 151 | }
|
151 | 152 |
|
152 | 153 | /**
|
153 |
| - * Create a MessageFormat for the given message and Locale. |
154 |
| - * @param msg the message to create a MessageFormat for |
155 |
| - * @param locale the Locale to create a MessageFormat for |
156 |
| - * @return the MessageFormat instance |
| 154 | + * Create a {@code MessageFormat} for the given message and Locale. |
| 155 | + * @param msg the message to create a {@code MessageFormat} for |
| 156 | + * @param locale the Locale to create a {@code MessageFormat} for |
| 157 | + * @return the {@code MessageFormat} instance |
157 | 158 | */
|
158 | 159 | protected MessageFormat createMessageFormat(String msg, Locale locale) {
|
159 | 160 | return new MessageFormat(msg, locale);
|
|
0 commit comments