selialkile opened a new pull request #173:
URL: https://github.com/apache/jspwiki/pull/173
I found a problem with many Italian texts that are not interpolated
correctly because it uses two different ways to load the texts. Some parts of
the Wiki is using an `rb.getStriong('security.error.illegalloginname')` and
some parts are using the `MessageFormat.format(
rb.getStriong('security.error.illegalloginname') )`, with that is very
difficult to fix all sentences that uses apostrophe in Italian.
I fixed some texts to enable the recovery password in Italian.
### How to test
```java
import java.io.*;
import java.text.MessageFormat;
class Simple{
public static void main(String argsx[]){
Object[] args = { "[email protected]" };
String wrongText = MessageFormat.format("Come richiesto, la nuova
password per l'autenticazione di \"{0}\" ", args);
System.out.println("Message: " + wrongText);
// result: Message: Come richiesto, la nuova password per
lautenticazione di "{0}"
String correctText = MessageFormat.format("Come richiesto, la nuova
password per l''autenticazione di \"{0}\" ", args);
System.out.println("Message: " + correctText);
// result: Message: Come richiesto, la nuova password per
l'autenticazione di "[email protected]"
}
}
```
### Proposal to open a issue
Create a new class to access the texts using the Method Overloading:
```java
class Texts {
public String getString(String name){
String text = rb.getString(name);\
Object[] args = {};
return MessageFormat.format(text, args);
}
public String getString(String name, Object[] args){
String text = rb.getString(name);
return MessageFormat.format(text, args);
}
}
```
Using that will be easier to maintain all texts with accents or symbols and
a easy way to implement a function to render HTML Entities.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]