Answers.Body: <p>Generally speaking, locales are designed to share the same templates, so craft is not necessarily looking for a <code>/template/[locale]/</code> folder to find the correct templates to load. You may have to specify the different locale template paths as part of your section settings in that locales database. As far as I know the only automatic locale routing happens in your public folder, if craft is trying to resolve a route for a static page.</p>
  
  <p>I'm curious as to why you would want to point the different locales to different databases? Keep in mind that structure and data are both stored in the craft database, so if you point 'locale1' at 'db1', and 'locale2' at 'db2', you are essentially loading two entirely separate sites (with their own CP, users, sections, fields, etc). This might make sense if you want to share templates and resources between the two sites. However, if you are also not sharing templates, then it might make more sense to just create two separate installations of craft.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Regarding licensing and subdomains. My understanding is that you can use the same craft license on more than one craft install as long as they share the same primary domain (subdomains are ok). In your case you would set up your local dev environment to be something like: 'project.craft.dev' and 'localeA.project.craft.dev'; and the production environment to be 'domain.com' and 'localeA.domain.com'. You can then purchase the license on 'domain.com' and copy the license file (<code>craft/config/license.key</code>) over to 'localeA.domain.com'.</p>
  
  <p>This is presuming of course that they share the same primary domain. What you can NOT do is create 'domain-localeA.com' and 'domain-localeB.com' using the same license.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-25T16:37:22.023Z
Answers.Text: I uploaded only files that will be overwritten. The idea behind all that is that I  wanted to avoid of loading others sites(as you said CP, sections, fields ...etc), when It's not necessary, you know... to save nature and my economy :) I would do it in domain way for each locale, but It would be too expensive.
Answers.UserDisplayName: Dominik Krulak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-25T16:42:18.163Z
Answers.Text: So the separate installation (as you mentioned in second paragraph) for each locale is the way for subdomain.domain.com with no need to buy extra licenses for each subdomain.
Answers.UserDisplayName: Dominik Krulak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-25T16:55:53.067Z
Answers.Text: That's my understanding—Yes.
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-25T15:58:51.410Z
Answers.LastActivityDate: 2015-04-25T16:51:44.287Z
Answers.LastEditDate: 2015-04-25T16:51:44.287Z
Answers.UserDisplayName: Douglas McDonald
Body: <p>The goal is to have single site (subdomain.domain.dev) with single locale(en_gb) in it and with one craft installation shared with this site only.</p>
  
  <p>I'm not sure if I configured <em>general.php</em> and <em>db.php</em> correctly to get subdomain.domain.dev loaded.</p>
  
  <p><strong>Production steps of What I did:</strong></p>
  
  <ol>
  <li><p>Set up host to point to subdomain - subdomain.craft.dev</p>
  
  <p>Folders structure:</p>
  
  <p><em>craft</em></p>
  
  <p><em>craft.dev</em></p>
  
  <p><em>subdomain.craft.dev</em></p></li>
  <li><p>Created database - subdomain_dev</p></li>
  <li><p>Uploaded necessary files to subdomain folder and edited one line of code</p>
  
  <p><code>// Tell Craft to serve the subdomain content
  define('CRAFT_LOCALE', 'subdomain');</code></p></li>
  <li><p>Uploaded en_gb templates to <em>../craft/templates/en_gb</em>.</p>
  
  <p>I'm not sure, If I also should edit <code>$craftPath</code> to point to templates files for <em>en_gb</em> locale.</p></li>
  <li><p>Edited <em>general.php</em></p>
  
  <p><pre><code>
  // All environments
  '*' => array(),
  // Development environment - Locale
  'craft.dev' => array( 
      'devMode' => true,
      'siteUrl' => array(
          'en' => '<a href="http://craft.dev" rel="nofollow">http://craft.dev</a>',
          'en_gb' => '<a href="http://subdomain.craft.dev" rel="nofollow">http://subdomain.craft.dev</a>'
      )
  )
  );</pre></code></p></li>
  <li><p>Edited <em>db.php</em></p>
  
  <pre>
  <code>
  // All environments
  '*' => array(
      'tablePrefix' => 'craft',
  ),
  
  // Development environment - Locale
  'craft.dev' => array(
      'server' => 'localhost',
      'user' => 'root',
      'password' => '********',
      'database' => 'craft_dev',
      ),
  // Development environment - Locale
  'subdomain.craft.dev' => array(
      'server' => 'localhost',
      'user' => 'root',
      'password' => '********',
      'database' => 'subdomain_dev',
      )   
  </code>
  </pre></li>
  </ol>
  
  <p>Locale en_gb was also created from back-end.
  When I load the <a href="http://subdomain.craft.dev" rel="nofollow">http://subdomain.craft.dev</a>, I get Twig_Error_Runtime saying, that <code>variable</code> doesn't exist.It's like templates in <em>../craft/templates/en_gb</em> wasn't found?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-25T16:05:19.073Z
Comments.Text: What are you trying to accomplish? Are you trying to create a single site with more than one locale (with shared templates and resources)? Or create entirely separate sites for each locale (nothing shared)?
Comments.UserDisplayName: Douglas McDonald
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-25T16:10:07.813Z
Comments.Text: The goal is to have separated sites for each locales by sharing the same domain. If I understand the licensing right, so I wouldn't have to buy licenses for each locale separately.
Comments.UserDisplayName: Dominik Krulak
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-25T16:12:57.683Z
Comments.Text: As far as I know you should not have to buy separate licenses. My understanding is that you can install as many version of craft as you want on the same domain (subdomains don't count). But might check with P&T to confirm.
Comments.UserDisplayName: Douglas McDonald
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-25T16:16:47.587Z
Comments.Text: When you buy your license for `domain.com`, you should be able to copy the license file over to the `subdomain.domain.com` install.
Comments.UserDisplayName: Douglas McDonald
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-25T16:26:25.423Z
Comments.Text: Thanks @Douglas McDonald. Have you already confirmed with P&T?
Comments.UserDisplayName: Dominik Krulak
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-25T16:33:31.663Z
Comments.Text: Yes. I've asked this before for my own server, as I often host development staging sites for my clients before I get a chance to set up their servers. (I.e. 'clientA.mycompany.com' and 'clientB.mycompany.com'; both of which use the license for 'mycompany.com').
Comments.UserDisplayName: Douglas McDonald
Tags: <multi-environment>
Title: Separated DB for each locale in subdomain with no shared Craft installation
ThreadText: # Separated DB for each locale in subdomain with no shared Craft installation
  
  (Asked by: username_0 on 2015-04-25)
  
  The goal is to have single site (subdomain.domain.dev) with single locale(en\_gb) in it and with one craft installation shared with this site only.
  
  I'm not sure if I configured *general.php* and *db.php* correctly to get subdomain.domain.dev loaded.
  
  **Production steps of What I did:**
  
  1. Set up host to point to subdomain - subdomain.craft.dev
  
     Folders structure:
  
     *craft*
  
     *craft.dev*
  
     *subdomain.craft.dev*
  2. Created database - subdomain\_dev
  3. Uploaded necessary files to subdomain folder and edited one line of code
  
     `// Tell Craft to serve the subdomain content
     define('CRAFT_LOCALE', 'subdomain');`
  4. Uploaded en\_gb templates to *../craft/templates/en\_gb*.
  
     I'm not sure, If I also should edit `$craftPath` to point to templates files for *en\_gb* locale.
  5. Edited *general.php*
  
     ```
  
     // All environments
     '*' => array(),
     // Development environment - Locale
     'craft.dev' => array( 
         'devMode' => true,
         'siteUrl' => array(
             'en' => 'http://craft.dev',
             'en_gb' => 'http://subdomain.craft.dev'
         )
     )
     );
     ```
  6. Edited *db.php*
  
     ```
  
     // All environments
     '*' => array(
         'tablePrefix' => 'craft',
     ),
  
     // Development environment - Locale
     'craft.dev' => array(
         'server' => 'localhost',
         'user' => 'root',
         'password' => '********',
         'database' => 'craft_dev',
         ),
     // Development environment - Locale
     'subdomain.craft.dev' => array(
         'server' => 'localhost',
         'user' => 'root',
         'password' => '********',
         'database' => 'subdomain_dev',
         )   
  
     ```
  
  Locale en\_gb was also created from back-end.
  When I load the <http://subdomain.craft.dev>, I get Twig\_Error\_Runtime saying, that `variable` doesn't exist.It's like templates in *../craft/templates/en\_gb* wasn't found?
  
  **Tags:** multi-environment
  
  > **Comments:**
  > **username_1**: What are you trying to accomplish? Are you trying to create a single site with more than one locale (with shared templates and resources)? Or create entirely separate sites for each locale (nothing shared)?  
  > **username_0**: The goal is to have separated sites for each locales by sharing the same domain. If I understand the licensing right, so I wouldn't have to buy licenses for each locale separately.  
  > **username_1**: As far as I know you should not have to buy separate licenses. My understanding is that you can install as many version of craft as you want on the same domain (subdomains don't count). But might check with P&T to confirm.  
  > **username_1**: When you buy your license for `domain.com`, you should be able to copy the license file over to the `subdomain.domain.com` install.  
  > **username_0**: Thanks @username_1. Have you already confirmed with P&T?  
  > **username_1**: Yes. I've asked this before for my own server, as I often host development staging sites for my clients before I get a chance to set up their servers. (I.e. 'clientA.mycompany.com' and 'clientB.mycompany.com'; both of which use the license for 'mycompany.com').  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-04-25. Score: 4 | Accepted answer
  
  Generally speaking, locales are designed to share the same templates, so craft is not necessarily looking for a `/template/[locale]/` folder to find the correct templates to load. You may have to specify the different locale template paths as part of your section settings in that locales database. As far as I know the only automatic locale routing happens in your public folder, if craft is trying to resolve a route for a static page.
  
  I'm curious as to why you would want to point the different locales to different databases? Keep in mind that structure and data are both stored in the craft database, so if you point 'locale1' at 'db1', and 'locale2' at 'db2', you are essentially loading two entirely separate sites (with their own CP, users, sections, fields, etc). This might make sense if you want to share templates and resources between the two sites. However, if you are also not sharing templates, then it might make more sense to just create two separate installations of craft.
  
  **Update**
  
  Regarding licensing and subdomains. My understanding is that you can use the same craft license on more than one craft install as long as they share the same primary domain (subdomains are ok). In your case you would set up your local dev environment to be something like: 'project.craft.dev' and 'localeA.project.craft.dev'; and the production environment to be 'domain.com' and 'localeA.domain.com'. You can then purchase the license on 'domain.com' and copy the license file (`craft/config/license.key`) over to 'localeA.domain.com'.
  
  This is presuming of course that they share the same primary domain. What you can NOT do is create 'domain-localeA.com' and 'domain-localeB.com' using the same license.
  
  > **Comments:**
  > **username_0**: I uploaded only files that will be overwritten. The idea behind all that is that I  wanted to avoid of loading others sites(as you said CP, sections, fields ...etc), when It's not necessary, you know... to save nature and my economy :) I would do it in domain way for each locale, but It would be too expensive.  
  > **username_0**: So the separate installation (as you mentioned in second paragraph) for each locale is the way for subdomain.domain.com with no need to buy extra licenses for each subdomain.  
  > **username_1**: That's my understanding—Yes.  
  
  ---
  
  