The official documentation recommends retrieving strings for internationalization like so:
document.querySelector("#appname").innerHTML = chrome.i18n.getMessage("appname");
However, the source code for the built-in pages such as the new tab page and the in-tab settings page (an example here) use a different method which doesn't require setting up additional JavaScript commands:
<title i18n-content="appname"></title>
I've tried to use this in my own web applications and extensions, but I can't seem to get it to work.
Can anybody shed some light on this? Is it possible to use this in web applications and extensions?
UPDATE: I've marked Mohamd Mansour's response as accepted, because technically it is correct. If anyone were looking for JavaScript-based solution, I've posted my own answer below.
You are looking at two completely different stuff. I will briefly explain.
For the first link, it is referring to Google Chrome Extensions API. If your making a Chrome extension, then you can use its internalization support API to do that. That is "only" for Extensions in Google Chrome.
For the second link, it is referring to the DOMUI within Google Chrome the browser. That is specifically made for Google Chrome! When we create Options page for Google Chrome (chrome://options/), we need to support multiple internationalizations, and in Google Chrome, all that is done in C++. Since the DOMUI pages interact with Chrome Browser UI and Core, we send messages back from the DOMUI (options page), and C++ (Browser). This implementation is specifically for Google Chrome internal.
Summarize
I hope that cleared things up.