Add the following code to your textBundle.js file. It has implemented an HTTP handler for the root URL using express. In the processing of this handler use the TextBundle library. When creating a new TextBundle instance the input are path (value messages to point to your message.properties file) and locale which should call getLocale passing in the req object. Then write into the res object with the TextBundlegetText function (passing in the text ID of greeting and two parameters of os.hostname() and os.type().

Look at the package.json file in the editor. You will see the dependencies section which lists all required libraries and their versions. You manually added the sap-textbundle and accept-language-parser modules to the dependencies section.

You need a few text files to test with. Right mouse click on the js folder and choose Import-> From File System. Choose the file i18n.zip from the Git repo. Keep all other settings at their default values. Choose OK.

We can now run the js module.

You should see that the build and deploy was successful.

However if you go to the tab where the service run was started, you will see an 11. Unauthorized message just as in previous sections. This is as intended.

So now run the web module.

In the running tab, you should see the index.html from earlier.

Now change the path in the browser to /node/textBundle. You should see the English message output from your text file in the i18n folder.

In order to test the translated strings, go into the browser Settings. Search for Lang and then choose the Language and input settings button.

Drag and drop to raise German to the top of the list

Refresh the web browser and you should now see the German text.

Repeat the process raising Japanese [ja] to the top of the list and refresh the web page