1 | var http = require("http")
|
2 | , express = require("express")
|
3 | , locale = require("../lib")
|
4 | , supported = ["en", "en_US", "ja"]
|
5 | , app = express.createServer(locale(supported))
|
6 |
|
7 | app.get("/", function(req, res) {
|
8 | res.header("Content-Type", "text/plain")
|
9 | res.send(
|
10 | "You asked for: " + req.headers["accept-language"] + "\n" +
|
11 | "We support: " + supported + "\n" +
|
12 | "Our default is: " + locale.Locale["default"] + "\n" +
|
13 | "The best match is: " + req.locale + "\n"
|
14 | )
|
15 | })
|
16 |
|
17 | app.listen(8000) |
\ | No newline at end of file |