Hi,
The
- com.opensymphony.xwork2.util.LocalizedTextUtil
was deleted with struts2 2.5.13.
But I use following code in my small project and I'm not sure, how to
replace it:
...
import com.opensymphony.xwork2.util.LocalizedTextUtil;
...
/*
* Get the i18n text for "string" from ActionContext
2017-09-22 15:40 GMT+02:00 Klaus Tachtler :
> String i18nString = LocalizedTextUtil.findDefaultText("global.unknown",
> ActionContext.getContext().getLocale());
Where do you use "i18nString"?
Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
-
Hi,
thank you for your reply.
I use it to fill up a bean with the string "unkonwn" or "unbekannt" to
show it later on the website.
So, what I want to do is, get a string in different languages from the
Resource-Bundle from the ActionContext.
Thank you!
Klaus.
2017-09-22 15:40 GMT+02:0
2017-09-22 15:57 GMT+02:00 Klaus Tachtler :
> I use it to fill up a bean with the string "unkonwn" or "unbekannt" to show
> it later on the website.
>
> So, what I want to do is, get a string in different languages from the
> Resource-Bundle from the ActionContext.
Why don't you use "getText(key)"
Hi Łukasz,
is it possible to use getText("global.unkonwn") with the
ActionContext.getContext().getLocale() like
- getText("global.unknown", ActionContext.getContext().getLocale());
Thank you!
Klaus.
2017-09-22 15:57 GMT+02:00 Klaus Tachtler :
I use it to fill up a bean with the string "un
2017-09-22 16:12 GMT+02:00 Klaus Tachtler :
> is it possible to use getText("global.unkonwn") with the
> ActionContext.getContext().getLocale() like
> - getText("global.unknown", ActionContext.getContext().getLocale());
You don't have to, I mean "getText(key)" does it for you - it uses the
current
Hi Łukasz,
can you give me an example, so that I can understand it right?
I have ActionContext and ActionContext.getContext().getLocale() BUT
how can I use getText(key) in my situation.
Thank you patience with me!
Klaus.
2017-09-22 16:12 GMT+02:00 Klaus Tachtler :
is it possible to use g
what class are you doing this in? Are you subclassing off of ActionSupport?
--
_
Adam Brin
Director of Technology, Digital Antiquity
480.965.1278
> On Sep 22, 2017, at 7:20 AM, Klaus Tachtler wrote:
>
> Hi Łukasz,
>
> can you give me an
Hi Adam,
no it is no a subclass.
package...
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
import net.tachtler.resources.Globals;
public class FileReader {
private static Locale locale = null;
public static Bean determine
Ok, then from your Action/Controller pass in a TextProvider into the method
which has the localization. All ActionSupport subclassess implement this, so
you can pass this in.
--
_
Adam Brin
Director of Technology, Digital Antiquity
480.965
Hi Adam,
can you give me a small example, to understand what you mean?
Sorry and thank you for your patience with me!
Klaus.
Ok, then from your Action/Controller pass in a TextProvider into the
method which has the localization. All ActionSupport subclassess
implement this, so you can pas
import com.opensymphony.xwork2.TextProvider;
public class FileReader {
private static Locale locale = null;
// not sure if this needs to be static
public static Bean determineFileReader(String userString, TextProvider
provider) {
String i18nString = provi
2017-09-22 16:39 GMT+02:00 Adam Brin :
> import com.opensymphony.xwork2.TextProvider;
>
> public class FileReader {
>
> private static Locale locale = null;
>
>// not sure if this needs to be static
> public static Bean determineFileReader(String userString,
> TextProvider
Hi Adam,
thank you so much for the example!
BUT from where can I get the "TextProvider provider" (you said all
ActionSupport classes implement this)
Thank you!
Klaus.
import com.opensymphony.xwork2.TextProvider;
public class FileReader {
private static Locale locale = null;
Borrowing from Lukasz’s improvement.
public class MyControlelr extends ActionSupport …
@Override
public String execute() {
String msg = getText(‘myMessageKey”);
FileReader.determineFileReader(msg, userString);
--
_
Adam Brin
Director
Hi,
thank you for the help!
I will try the solution and implement it.
Thank you!
Klaus.
Borrowing from Lukasz’s improvement.
public class MyControlelr extends ActionSupport …
@Override
public String execute() {
String msg = getText(‘myMessageKey”);
FileReader.determineFileReader(msg,
Hi,
thank you once again for your support, Łukasz and Adam!
@Łukasz: you're absolutly right to say:
"I would rather pass a localised string to the bean (if possible), this
creates a dependency on Struts in non-Struts related bean"
Depending on that I ONLY want to use the same resource bundle as
Hi Team,
We are migrating our application from Struts v2.2.1.1 to Struts v2.3.34 to fix
the vulnerability issues.
We followed below steps,
1. Replaced
o struts2-core-2.3.34.jar
o struts2-tiles-plugin-2.3.34
o xwork-core-2.3.34
o all tiles-- 2.2.2
o Updated dependent jar
18 matches
Mail list logo