I have wondered what type 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 granularity.
One specific example that I am working on at the moment relates to internationalization of an application.
First of all English is the default language, but the application will be used in two different regions, Americas and Europe. In most cases, the various pieces of text and labels will be the same between the two regions, but in some cases the technical terms will differ based on the region. When translating the text to a different language, some will retain the original English text for the region.
So looking up the text for a label would work like this. Look at the specific combination of region and language. If there is nothing, look at language only. If nothing, look at combination of English and Region. If nothing, look at English only.
I am looking for the best ways for storing this type of data in a database as well as in a data structure within the code. Either in this specific case, or in general for these types of situations.