Technical Articles
Multi language label texts handling in CDS based Fiori Elements apps
Fiori Elements Multi Language Text Handling:
This Blog is about maintaining the multi- language label text for Fiori elements-based applications which is generated with the help of CDS. Annotations plays a key for role generating and rendering of the respective UI applications.
(For more information on Fiori Elements check this link: https://experience.sap.com/fiori-design-web/smart-templates/)
Generally, we use I18N properties for Language based text handling in UI5 applications but in case Fiori Elements CDS based applications, UI elements texts can be handled effectively with CDS UI annotations and Translator editor.
How to guide
- Create the consumption CDS with the help of UI Annotations(which can be exposed for ODATA , directly or via SEGW reference data source).
- Use Label Annotation for defining the text for the respective UI elements (for example: Line Item, selection fields, header, Identification etc)
- Once CDS are created and activated, maintain the multi-language Text for the CDS in Translator editor -SE63
- Create the Fiori elements-based app from the WEBIDE tool, select the Template (i.e. List Report/ Overview Page)
Detailed explanation with example
Consumption CDS with the UI annotations
Annotations for Label for the UI Elements as below:
Maintain Text for the UI Labels used in CDS
a) Go to T Code SE63 and select Short Text
b)Drill Down to A5 and select DDLS- CDS views
c) Enter the CDS Information and Maintain the Texts. In the below example, we are maintaining the Text in French(FR), Click on Edit.
d)Text Maintenance in French Language, For Example I have used “FR” as prefix to show the Text in French:
Create the Fiori Elements based List Report
Consume the generated ODATA Service in WEBIDE and select List Report. For more information for generating the list report refer following link
ABAP Programming Model for HANA
Testing the Application(Multi Language Test)
Initially I have default language set in Chrome Browser as English, report will show all the label in English
Now change the Language to French (FR) in Chrome browser , clear the cache and test again.
Output
Clear the browser cache and execute the application again, we can see all the Labels for which Texts are maintained in French
Summary:
Multi Language Label texts can be maintained directly by backend Translator edittor(SE63) for the CDS based Fiori elements applications. No need for maintaining label texts explicitly in generated UI5 application’s I18N files.
Very informative blog Mohit..
Thanks Mohit for this informative blog. We are still using Se63 for translation in world of S4 HANA and cloud surprise me sometime:P. I hope we have a better translation tool available in place of SE63( if already their is not aware of).
very informative Mohit.. Keep it coming!
Good One Mohit
Very Informative Content Mohit .
Great Blog Sir. Very helpful
Hi Mohit,
I was trying to do same but getting the error "Incorrect Page Code".
When I click on F4 in Target Language getting only a single record - enUS.
Please could you suggest if I am doing wrong way.
Thanks & Regards,
Dhiraj
HI Mohit
I have defined a Metadata Extension with Fieldgroups for a Fiori Elements List Report.
e.g.
@UI.facet: [
{ label : 'Details', id: 'idDetail', type: #COLLECTION , position: 20, importance: #HIGH },
I tried the above approach to translate the Labels for the Field Groups but the Field Group labels do not appear. Can you advise how we can translate FieldGroup Labels please?
Regards
Mark
Did you ever find a solution?
Hi Paul - at the time I think I ended up using Run Time Adaptations to do this.
I've seen OTR being used but not sure if that is relevant in facet, just not had time to investigate it though.
Question about 'forcing' a specific language irregardless of the browser language, system default language, etc. Is their an annotation which can be use which will force the data dictionary texts?
This is a hypothetical.
Hi Mohit,
it is very nice and helpful for beginner like me. Hope to see more blogs from you.
Is this somehow connected to using UI5 flexibility services / UI adaption to change standard apps? When I change a label with UI Adaption, how can this be translated?
Hi,
I have tried above approach for CDS View column Headings translations in German its not reflecting
Text Translations:SE63----->Short Texts---->A5---->CDS Views--->ZXX_EXT2 ie EN to DE
Extended STD CDS as ZCDS_EXT, can please help us.
@AbapCatalog.sqlViewAppendName: 'ZXX_EXT2SQL'
@EndUserText.label: 'Supplier Invoice List C'
extend view C_SupplierInvoiceList with ZXX_EXT2
{
@EndUserText: {label: ' Heading2'}
invoice.Field2,
@EndUserText: {label: ' Heading1'}
invoice.Field1}
Hi,
For translating texts in the metadata file, goto SE63 in the backend
Your CDS extension is in a transport somewhere with the key R3TR | DDLX | <your metadata extension >
Use this in SE63 --> Translation --> ABAP objects --> Transport object
Use the key and translate.
Kind regards,
Geert
How do you transport the translated text of a CDS views.
This:
SE63 --> Translation --> ABAP objects --> Transport object
does not transport, it translates what's in the transport. I need to transport what I already translated.