0

I have an application where we are showing quotes from a client in a JSP. The actual text of the quotation is stored in a database and doesn't include the quotation marks.

The JSP currently has "{$bean.quote}" which, I pointed out to my boss, is not internationalizable.

I've got his approval to internationalize this, but I'm not sure what approach to use. My first one is to do an i18n lookup for startQuote and endQuote and store the character in the table. This feels heavy.

Ideas?

Thom
  • 14,013
  • 25
  • 105
  • 185

1 Answers1

0

That is one way to do it. But you're right; if you're doing it in a lot of places, it's going to be awkward to read and maintain.

HTML has a special element for this: q. So you can put this in your page:

<q>${bean.quote}</q>

You can then perform the internationalization in the CSS, as described in the Quotation marks section of the CSS specification:

q:lang(en) {
    quotes: '\201c' '\201d' "\2018" "\2019"
}
q:lang(no) {
    quotes: "\ab" "\bb" '"' '"'
}

q:before {
    content: open-quote;
}
q:after {
    content: close-quote;
}
VGR
  • 40,506
  • 4
  • 48
  • 63