1

I have a small webapp in java and I am adding the internationalization support, replacing texts with labels that are defined in dictionary files.

While some texts are obviously unique to each view (v.g. the html title), other refer to concepts from the model (v.g. a ticket, the location or status of such ticket, etc.)

As usual, some terms will appear many times in different locations (vg, in both the edition page and in the search page and in the listings I have a "ticketLocation" label).

My question is: can I organize the labels around the model concepts (so I have a ticket.location label and I use it everywhere such field is labeled) or should I make a different label for each (so form.ticketLocation and filter.ticketLocation and list.ticketLocation).

I would go for the first option; I have searched for tips and the only thing that I see that could hinder me is due to the length of the string disrupting the design, and even for that I would prefer having to add a ticket.locationShort for places where there is not much space.

What is your opinion/tips/experience?

1
  • If you found an answer useful please mark it as the correct answer.
    – Ryan
    Commented Nov 22, 2012 at 18:53

1 Answer 1

2

Short answer: organize around the model concept.

Long answer:

DRY, especially when you are creating the labels for localization purposes.

Every time you repeat a label you are creating more text which you will either have to pay to have translated (hurts your bottom line) or translate yourself (costs you time, which again hurts your bottom line).

Also it can quickly bloat your dictionary to gargantuan size. Which can affect performance. I can think of no better place to adhere as much as possible to the DRY principle then with localization.

1
  • 1
    Also, when organizing around the model concept, it makes it much easier to search for localized strings stored in the database. Which means, effectively, your localization tends to be structured around the model anyways. Commented Nov 15, 2012 at 22:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.