title: How to build phrase language translation engine in Java
body: <p>In the process of designing an engine which will be used to translate phrases that are processed by the application.</p>
  
  <p>The ideal is to look for a set element in the XML, identify it by its category and then submit it to a translation engine that will check to see if the phrase has already been converted or needs to be.  If it does it will be placed into a translation table.</p>
  
  <p>The basic structure of the table A is:</p>
  
  <pre><code>element_id | element_type | category_type | value | language_id
  </code></pre>
  
  <p>Now there is a GUI that will be used to do the translation.  User will select a given element and category from drop downs along with the from language and the to language.</p>
  
  <p>Using the element, category and language a list will be display of those items that have not been converted.</p>
  
  <p>User then will enter in the converted phrase.</p>
  
  <p>The thought to manage all this is to use a mapping table:</p>
  
  <pre><code>mapping_id | element_from_id | element_to_id | from_language | to_language
  </code></pre>
  
  <p>So lets say we have the following in the first table</p>
  
  <pre><code>1 | DMG_AREA | DAMAGE | Quarter Panel - Left | EN
  </code></pre>
  
  <p>User translates it into FR using the GUI</p>
  
  <p>Now table looks like this:</p>
  
  <pre><code>1 | DMG_AREA | DAMAGE | Quarter Panel - Left | EN
  2 | DMG_AREA | DAMAGE | QPL                  | FR
  </code></pre>
  
  <p>The second table looks like this</p>
  
  <pre><code>1 | 1 | 2 | EN | FR
  2 | 2 | 1 | FR | EN
  </code></pre>
  
  <p>So that we can then build the resource bundles by doing a simple query of Table B to determine the key/value pair for a "resource bundle" hashmap that will be placed into memory for on the fly translation.</p>
  
  <p>Suggestions for improvement - does it make sense - is there a simpler way - open source solution already out there?</p>