Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
    
If you found an answer useful please mark it as the correct answer. –  ryan Nov 22 '12 at 18:53
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
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. –  Clockwork-Muse Nov 15 '12 at 22:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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