The project that we will create in this chapter is a simple weekend countdown tool. This will display a little piece of text that indicates the current day of the week, and then says how many days are left until the weekend.
The main point of this application will be to make practical use of the translation system that we saw earlier. For that reason, we will first write some code, and then do a little translation.
Note
While we will consistently use the Drupal.t()
function in this book, this is the only place where we will be writing a translation. You do not need to provide translations along with your theme or module (though if you have the ability to do the translations, it sure would be nice).
Our code is once again going to be attached to the frobnitz
theme. The script file will be named day.js
. Make sure you include it in the frobnitz.info
file: scripts[] = day.js
.
var Day = Day || {}; Day.dayNames = [ Drupal.t("Sunday"), Drupal.t("Monday"...