Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'd personally have as follows:</p> <pre><code>Table: Language Id, Name Table: Translation Id, UniqueName(IdxUnique), LanguageId(FK), TranslationText Table: Question Id, TranslationUniqueName(FK) Table: Answer Id, QuestionId(FK), IsRight, TranslationUniqueName(FK) </code></pre> <p>I'm torn between using an Id for the Translation and a UniqueName (Key) - Id is probably <em>marginally</em> beneficial in terms of performance but using a Meaningful Unique key makes development easier (eg Set something to <code>WelcomeText</code> and let the system look up the translation is far cleaner than setting it to <code>16</code>)</p> <p>Also, Keys are more portable if you're adding/deleting/duplicating translations, especially across multiple database instances (different environments).</p> <p>In Response to your comments on the other answer, for when no language is selected, you could add weightings in the <code>Language</code> table itself or associate a <code>LanguageId</code> with the user account. You could also (if you want to be clever) attempt to guess based on the location of the user (but ofc you should always give them the option to change - nothing more annoying than being redirected to <code>google.es</code> when you're in Spain).</p> <p>In any case, your method to do the translation should do this for you - eg your app just makes a <code>GetTranslation('WelcomeText')</code> - Your <code>GetTranslation()</code> method can then look up the appropriate language to use and get the correct <code>string</code>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload