23.12.2012 Views

ZK Developer's Guide

ZK Developer's Guide

ZK Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

media = com.packtpub.zk.media.model.MediaFactory.create();<br />

}<br />

<br />

<br />

<br />

The title of the media.<br />

<br />

<br />

A Song.<br />

<br />

<br />

A Movie.<br />

<br />

[ 121 ]<br />

Chapter 4<br />

<br />

The id for the media. That is a user defined id.<br />

The id must be unique.<br />

<br />

<br />

The description for the media.<br />

<br />

<br />

Upload a image for the media.<br />

<br />

<br />

Internationalization with the <strong>ZK</strong> Framework<br />

Before we end the chapter, and the tutorial part of this book, we should look at how<br />

internationalization is done with <strong>ZK</strong>. For that we will use login.zul page from the<br />

previous chapter.<br />

The <strong>ZK</strong> framework comes with a built-in functionality to separate the name of the<br />

labels in a property file. The name of the property file is i3-label_lang_CNTY.<br />

properties. lang is the language (for example: en) and CNTY is the country<br />

(for example US). The file must be located in the WEB-INF directory of the web<br />

application. If the file is not found, the file i3-label_lang.properties is loaded,<br />

and if that fails the framework tries to load i3-label.properties. To access the<br />

properties, you can use org.zkoss.util.resource.Labels.<br />

For completeness, the new implementation of login.zul is as shown:<br />

<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!