dgmora
dgmora

Reputation: 1269

Why shouldn't I use static text on web interface?

In my case, the question is concretely on JSF, but it can be applied to any technology using web interfaces.

I am mantaining a web interface (xhtml, using JSF), which is all static text (harcoded).

Instead of using hard-coded text, the other option is using something like <h:outputText value=" #{msg['hello.world']} > and put hello.world in a properties file. This allows you to go i18n very easily.

Intuitively, this option is better, but in case you never ever plan to i18n, is it better than just coding? I did not find any clear answer to that question.

Upvotes: 1

Views: 91

Answers (2)

juanignaciosl
juanignaciosl

Reputation: 3573

It also translates html entities nicely, and allows you to reuse text, which will lead to consistency.

Upvotes: 0

Jigar Joshi
Jigar Joshi

Reputation: 240928

You can centralize messages, so in case you need to change a label you don't need to search whole project and replace it every where, You could simply replace it in message bundle

It also enables i18n

You can have parametrized messages

Upvotes: 5

Related Questions