on 11-26-2009 12:09 PM
H experts,
I declared an Assistance-class and added a text (text ID 001, value "MARKE" (system language is german).
No I add an button on my dynpro to switch Button (English/German). When I click on the English button, I want to change the text from a TextView from MARKE to BRAND.
I tried it this way:
SET LANGUAGE 'E'.
DATA: l_text TYPE string.
l_text = wd_assist->if_wd_component_assistance~get_text( '001' ).
wd_context->set_attribute( name = 'BEZ_MARKE'
value = l_text ).
Nothing happens - always get the german text. And yes, sure, I translated the text with GOTO -> Translation
What am I doing wrong? Is there a parameter for the get_text-method?
regards
Michael
Hi,
you can use below:
DATA lv_user_id_tr LIKE ls_cv_lang_translation-user_id_tr.
lv_user_id_tr = wd_assist->if_wd_component_assistance~get_text( key = '000').
*set attribute
lo_el_cv_lang_translation->set_attribute(
EXPORTING
name = `USER_ID_TR`
value = lv_user_id_tr ).
SET LANGUAGE 'E'.----why is this used.
you can use OTR to transalte the text.
[http://wiki.sdn.sap.com/wiki/display/stage/OTRTextTranslationToolforWebDynpro+ABAP]
Priya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Priya,
perfect, I will have a look at your input as soon as possible - unfortunatelly our Sandbox-system have to be shut down now for updating reasons...
I will come back to this after testing it...
Hi amit,
thank you also for your input...test this as soon as possible
regards
Michael
Also Saurav Mago thank your for your response
hi ,
proceed as follows ( refernce Intenationalisation in WD ABAP applications )
1 Create a OTR object for ur text view UI element
Create a OTR object for the UI element
2 Click on GOTO-> Online TEXT Repository Browser
3 give the package name
Also, each OTR object will have an alias name which is
*<package name>/<OTR_Object_name>
and can be accessd by
get_otr_text_by_alias
4 Bind the OTR object to the UI element in text property
Select the appropriate alias created for ur text view . This will bind the OTR object to the UI element
Note the text property is now bonded to the OTR object.
In order to Maintain Translations
1 GO to SOTR_EDIT Transaction
2 Enter ALIAS name and click on Display
3 In next screen, select Edit-> Context->Change
4 for the languge in which u need to trnslate , fill the text with the language and save it
refer the related content :
https://wiki.sdn.sap.com/wiki/display/stage/OTRTextTranslationToolforWebDynpro+ABAP
https://wiki.sdn.sap.com/wiki/display/WDABAP/TranslatingTextswith+SOTR
regards,
amit
Hi at all,
now I have thested the OTR-Translation Utility.
Looks very nice, it shows me all my text views I use in my Dynpor. Also I can translate them.
But what are the next steps? How can I change the language of my dynpro by clicking one button?
I want to do the following:
I open the Dynpro, for example in German. On the dynpro there's a button "English". After clicking this, I want all texts to be translated into English...
Any ideas?
HI,
I dont think there is any way to do all translation at a same time. You have to explicitly write the code for each text which ever you want to display and on the click of button (English or German ) , you have to translate them using :
data lvalue type string.
lvalue = cl_wd_utilities=>get_otr_text_by_alias(
alias = 'Z3AF_TM_OTR/NP4_NUMBER'
language = 'EN' )
After translating bind the text view with the value using set_Attribute method :
lo_el_tr->set_attribute(
EXPORTING
name = `CA_Text1`
value = lvalue ).
hi Michael ,
u hv to maintain a method to do the trnslations , using get_otr_text_by_alias method
lv_alias = cl_wd_utilities=>get_otr_text_by_alias(
alias = '$TMP/SAVE
)
where $TMP is the PACKAGE name and SAVE is ur alias
thn u can set the attibutes using set_attibute method , as SAURAV pointed , the text wud be trnslated in the intended language
DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
DATA ls_cn_node TYPE wd_this->element_cn_node .
* navigate from <CONTEXT> to <CN_VISIBLE> via lead selection
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_ca_attr).
* get element via lead selection
lo_el_cn_node = lo_nd_cn_node->get_element( ).
* get single attribute
lo_el_cn_node->get_attribute(
EXPORTING
name = `CA_ATTR`
IMPORTING
value = lv_alias ).
where
// lv_alias is a data declaration type string
DATA : lv_alias TYPE string
// n u have use the method get_otr_text_by_alias
I hope it shud help
rgds,
amit
Hi,
Write a method and put your code to translate all your texts in that method using OTRs explained by others. On click of your language button, call this method passing the language. Once you translate the texts as per the required language, you can export all those texts and bind to the context. You will see the required language display on click of the button.
Murthy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I dont know whether l_text = wd_assist->if_wd_component_assistance~get_text( '001' ).
would fetch text based on language you set or not. Generally this would fetch the text based on sy-langu.
For fetching text based on languge , you could make an OTR for that and thus pick the text based on the language you want.
data value type string.
value = cl_wd_utilities=>get_otr_text_by_alias(
alias = 'Z3AF_TM_OTR/NP4_NUMBER'
*language = 'EN'* )
In above code 'Z3AF_TM_OTR - OTR package and NP4_NUMBER' is my OTR created.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi ,
make use of OTR for the same
Rfer this pdf for ur requirement :Internationalisation in WD ABAP applications
refer the SAP online help
Translating objects directly
http://help.sap.com/saphelp_nw70/helpdata/EN/41/71601b3ab0f34a8e00aa01338c68f3/content.htm
Quick Start for Translators :
http://help.sap.com/saphelp_nw70/helpdata/EN/77/571a00492011d1894a0000e829fbbd/content.htm
also refer the wiki :
http://wiki.sdn.sap.com/wiki/display/stage/OTRTextTranslationToolforWebDynpro+ABAP
regards,
amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.