I wondered what types of data structures and design patterns are used when implementing something like CSS, where you can specify formatting or some other property at different levels of detail.
One specific example I'm currently working on is internationalizing an application.
First of all, English is the default language, but the application will be used in two different regions, in America and Europe. In most cases, different fragments of text and labels will be the same between the two regions, but in some cases the technical terms will differ depending on the region. When translating text into another language, some retain the original English text for the region.
Thus, the text search for the shortcut will work as follows. Look for a specific combination of region and language. If there is nothing, look only at the language. If nothing, look at the combination of English and the region. If nothing, look only at the English language.
I am looking for the best ways to store this type of data in a database, as well as in a data structure in code. Either in this particular case, or in general for these types of situations.
source
share