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 of Technology, Digital Antiquity
480.965.1278
> On Sep 22, 2017, at 8:02 AM, Klaus Tachtler <[email protected]> wrote:
>
> 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;
>>
>> // not sure if this needs to be static
>> public static Bean determineFileReader(String userString, TextProvider
>> provider) {
>>
>> String i18nString = provider.getText("global.unknown");
>> ...
>>
>> }
>> --
>> _________________________________________________________
>> Adam Brin
>> Director of Technology, Digital Antiquity
>> 480.965.1278
>>
>>> On Sep 22, 2017, at 7:36 AM, Klaus Tachtler <[email protected]> wrote:
>>>
>>> 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 pass this in.
>>>> --
>>>> _________________________________________________________
>>>> Adam Brin
>>>> Director of Technology, Digital Antiquity
>>>> 480.965.1278
>>>>
>>>>> On Sep 22, 2017, at 7:31 AM, Klaus Tachtler <[email protected]> wrote:
>>>>>
>>>>> 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 determineFileReader(String userString) {
>>>>>
>>>>> /*
>>>>> * Set local variable locale read from actionContext.
>>>>> */
>>>>> locale = ActionContext.getContext().getLocale();
>>>>>
>>>>> /*
>>>>> * Get the i18n text for "string" from ActionContext.
>>>>> */
>>>>> String i18nString =
>>>>> LocalizedTextUtil.findDefaultText("global.unknown", locale);
>>>>>
>>>>> ...
>>>>>
>>>>> }
>>>>>
>>>>> This is, what I'm doing.
>>>>>
>>>>> By changing from struts2 2.5.10 to 2.5.13 I saw the problem and I don't
>>>>> know ho to fix it the right way?
>>>>>
>>>>> Thank you!
>>>>> Klaus.
>>>>>
>>>>>
>>>>>> 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 <[email protected]> wrote:
>>>>>>>
>>>>>>> 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 <[email protected]>:
>>>>>>>>> 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 Locale defined in ActionContext
>>>>>>>>
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> --
>>>>>>>> Łukasz
>>>>>>>> + 48 606 323 122 http://www.lenart.org.pl/
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>>
>>>>>>>
>>>>>>> ----- Ende der Nachricht von Lukasz Lenart <[email protected]>
>>>>>>> -----
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> ------------------------------------------
>>>>>>> e-Mail : [email protected]
>>>>>>> Homepage: http://www.tachtler.net
>>>>>>> DokuWiki: http://www.dokuwiki.tachtler.net
>>>>>>> ------------------------------------------
>>>>>>>
>>>>>>>
>>>>>>> <Mail Attachment>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>> For additional commands, e-mail: [email protected]
>>>>>
>>>>>
>>>>> ----- Ende der Nachricht von Adam Brin <[email protected]> -----
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> ------------------------------------------
>>>>> e-Mail : [email protected]
>>>>> Homepage: http://www.tachtler.net
>>>>> DokuWiki: http://www.dokuwiki.tachtler.net
>>>>> ------------------------------------------
>>>>>
>>>>>
>>>>> <Mail Attachment>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>> ----- Ende der Nachricht von Adam Brin <[email protected]> -----
>>>
>>>
>>>
>>>
>>> --
>>>
>>> ------------------------------------------
>>> e-Mail : [email protected]
>>> Homepage: http://www.tachtler.net
>>> DokuWiki: http://www.dokuwiki.tachtler.net
>>> ------------------------------------------
>>>
>>>
>>> <Mail Attachment>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>
>
> ----- Ende der Nachricht von Adam Brin <[email protected]> -----
>
>
>
>
> --
>
> ------------------------------------------
> e-Mail : [email protected]
> Homepage: http://www.tachtler.net
> DokuWiki: http://www.dokuwiki.tachtler.net
> ------------------------------------------
>
>
> <Mail Attachment>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]