How can I set supported languages in a Fiori application? - sapui5

When we have a stand alone app that has index.html we can have something like data-sap-ui-xx-supportedLanguages="en,de" in the bootstrapping part to determine which languages are implemented in our app. In this case we will not see anymore an error like this:
https://webidetestingXXX.dispatcher.hana.ondemand.com/webapp/i18n/i18n_en_US.properties 404
because we determined that our app does not support en_US!
How can I do the same in a Fiori type application, I mean when we don't have any index.html and it has only Component.js as the starting point!
I remember in the past we set that in manifest.json, but I am not sure!

It is mentioned under the chapter Supported Locales and Fallback Locale in this documentation: https://openui5.hana.ondemand.com/topic/ec753bc539d748f689e3ac814e129563
{
"sap.ui5": {
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "myapp.i18n.i18n",
"supportedLocales": ["de", "en"],
"fallbackLocale": "de"
}
}
}
}
}
This manifest.json configuration is only supported since UI5 1.77.
For lower releases there is apparently no application-level configuration.

Related

SAPUI5 - sap.m.Input: Will it automatically invoke a soft(virtual)-keyboard if running on the proper device?

As we can see in the manifest file of each SAPUI5 application, there is the array of device-types, which usually has stuff like this inside:
"sap.ui": {
"technology": "UI5",
"icons": {
"icon": "",
"favIcon": "",
"phone": "",
"phone#2": "",
"tablet": "",
"tablet#2": ""
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
}
I am developing my first SAPUI5 application right now, and I wonder, if the runtime or core somehow knows, when to invoke a virtual keyboard (like on tablets, smartphones and other touchscreen-only devices), and then just simply does it.
Since I am not able to BYOD to test it in my current setup, I wanted to ask in here, if my assumption is right or not.
UI5 is at the end only a webpage. Every input on any webpage (e.g. just open amazon) opens the keyboard; if the input is focused.
What exactly happened depends heavily on your browser, device, etc.
If you are ever in doubt and your company is not allowing BYOD and if there aren't any other touch devices (convertible notebooks) you can at least use the examples on your private device.
Off-topic - If you have a MAC-Book you can also spin up the iphone emulator from xcode and access localhost.

How to create a page tab for a specific work items type?

I am building a new page tab extension for Azure DevOps. I would like the new tab to only show on
test cases work items type like this:
Following their documentation, the new page tab is added to all work items. Maybe I missed something from another part of their documentation?
Here is my contribution manifest:
{
"id": "sample-work-item-form-page",
"type": "ms.vss-work-web.work-item-form-page",
"description": "Custom work item form page",
"targets": [
"ms.vss-work-web.work-item-form"
],
"properties": {
"name": "My Page",
"uri": "form-tab.html",
"categories": ["Azure Test Plan"]
}
}
As far as I know, you didn't miss any steps.
Generally, we will define the scope and type in the extension manifest file.
From this doc about the manifest reference, I am afraid that there is no such definition could specify a specific type of work item.
Workaround:
You could navigate to Organization Settings -> Process -> Target process ->Edit Work item and use the Hide from layout option to hide the tab for the work item type.
Here is a discussion about this feature, you may refer to it.
We considered letting the extension author specify this in their JSON
manifest but that is too limiting since users will soon be able to
create custom work item types and an extension author would never know
what those are.
Hope this helps.

Access controller of another application in SAPUI5

I have some SAPUI5 applications in one SAP server. All the applications will be deployed in an ERP Server Version 6.0.
All the applications has a access url in our ERP server that can be retrieved through the SAP NetWeaver. All the urls have the format commonPart/applicationName/index.html. All of these application will be accessible through a Fiori launchpad application.
Now I have a controller that has to be shared between all my applications. Is there any method that I can share this controller without copy and past?
Thanks in advance
You can create a reusable library project for SAP Fiori applications. Put your BaseController in that library. Then import the library in your application project and extend your application controller from BaseController.
Define library.js in root folder of your base project
sap.ui.define(["jquery.sap.global",
"sap/ui/core/library"], // library dependency
function(jQuery) {
"use strict";
// delegate further initialization of this library to the Core
sap.ui.getCore().initLibrary({
name: "mylibrary.reuse",
version: "1.0",
dependencies: ["sap.ui.core"],
types: [],
interfaces: [],
controls: [],
elements: [],
noLibraryCSS: true
});
return mylibrary.reuse;
}, /* bExport= */ true);
Declare the BaseController within it's JS file
jQuery.sap.declare("mylibrary.reuse.BaseController");
/** Controller Definition **/
Define and expose entry points to your library in neo-app.json
{
"routes": [{
"path": "/resources/mylibrary/reuse",
"target": {
"type": "application",
"name": "myreuselibrary",
"entryPath": "/mylibrary/reuse"
},
"description": "SAPUI5 Resources"
},
}
Then import the above library in application project, do JQuery.require() got BaseController and then extend it.
I hope this helps.
You could make a BaseController which has all of the functions that you want both controllers to have, and put this js file in a public/shared folder. Then, you can extend this controller from both applications.
you can simply type in the following
sap.ui.controller([your namespace].[controller folder name].[controller name]).[your method name]([parameters you want to pass])
for example
sap.ui.controller(CafApp.controller.create).onCreate(url);

What does "ach" stand for? In manifest file, in overview application of SAP

This is an extract from manifest.json file of my overview application.
created using annotations
https://blogs.sap.com/2016/01/29/steps-to-create-analytic-card-on-overview-page-using-northwind-odata-service-v3-in-web-ide/
"sap.app": {
"id": "ovpdemo",
"type": "application",
"i18n": "i18n/i18n.properties",
"applicationVersion": {
"version": "1.2.2"
},
"title": "{{app_title}}",
"description": "{{app_description}}",
"ach": "sap",
It refers to SAP Support component which you need to use while raising bugs to SAP.
To be precise:
Application component hierarchy (SAP's component names for bug
reports); attribute is mandatory for SAP apps, but is not used so far
for apps developed outside SAP
Cited from:
https://help.sap.com/viewer/0ce0b8c56fa74dd897fffda8407e8272/7.5.6/en-US/be0cf40f61184b358b5faedaec98b2da.html

How can i keep listening to a websocket in a chrome packaged app?

Currently when a background process always becomes inactive, even when i'm waiting for data from a websocket. Is there a way to circumvent this? The documentation is not clear at all in this department (old documentation etc.). What is the 'new' and correct way to do this?
My manifest file:
{
"name": "Media 5",
"manifest_version": 2,
"description": "Html5 media center app for Chrome",
"version": "0.1",
"app": {
"background": {
"persistent": true,
"scripts": ["background.js"]
}
},
"icons": { "16": "small_icon.png", "128": "big_icon.png" },
"sandbox": {
"pages": ["sandbox.html"]
},
"permissions": [
"unlimitedStorage",
"fullscreen",
"notifications",
"webview"
]
}
There are lots of ways to prevent your event page from getting unloaded, including those listed here: http://developer.chrome.com/extensions/event_pages.html. Give one of those a try. Open a message port, or set a chrome.alarms alarm for about a 5-second interval. I don't believe it's documented behavior, but event pages are typically unloaded after 10 seconds of inactivity, so the alarm ought to keep you alive.
I've filed a bug about this; it might be smarter for us to avoid unloading if you're using websockets.
Another thing that keeps packaged apps alive is having an active callback. So, for example, you could use setTimeout with a timeout value of say 5 to ensure you app remains alive. This is only a workaround though, and there should be a better way to reconcile lifetime of websockets and packaged apps.
There is a Chromium bug (https://code.google.com/p/chromium/issues/detail?id=204573) tracking this issue.
As an FYI (because this is confusing), the "persistent": true line is currently ignored by Chrome. Packaged Apps (v2) are always set to "persistent": false.