<p>I changed the /page/_entry to:</p>

<pre><code>                {% include ["pages/_#{subpage.type}", "pages/_#{subpage.slug}.html", "pages/_#{subpage.id}.html", 'pages/_default.html'] with {entry: subpage} %}
</code></pre>

<p>This way it first uses the page type, then the slug, then the id and at last the default page.</p>

<p>This allows for easy localized templating with using the same templates.</p>

<p>Thanx @carls</p>

CC BY-SA 3.0
2014-09-09T08:45:47.633Z
2014-09-09T08:45:47.633Z
nexflo
<p>You can create new template files for your second locale and simply use Twig include to only maintain one template for all of your locales.</p>

<p>projekte.html:</p>

<pre><code>{% include 'projects.html' %}
</code></pre>

<p>Use a locale specific subfolder (craft/templates/de/) to separate the german templates from your main / first locale templates (see the <a href="http://buildwithcraft.com/docs/templating-overview#template-localization" rel="nofollow">Template Localization</a> article in the Docs on how this works).</p>

<p>Another way to handle localized URIs is to not use "URI to template matching" (pt. 6 in the <a href="http://buildwithcraft.com/docs/routing" rel="nofollow">Routing</a> article) but configure an entry that loads your template instead (pt. 4). </p>

<p>Create a single section with "projects.html" for the template that should get loaded if the single's URL is requested. The template's filename is irrelevant for the URI matching and you can set the entry's slug to whatever you want in both of your locales.</p>

<p>Before creating many single sections now, also consider using a "Pages" structure section instead.</p>

CC BY-SA 3.0
2014-09-08T14:03:16.603Z
2014-09-08T14:03:16.603Z
carlcs
<p>We are building a multilingual site.</p>

<p>We have different domains and slugs for German and English pages/sections  i.e. <code>projects</code> is called <code>projekte</code>...</p>

<p>Right now the template used is called "projects.html" which we want to use for all languages, but Craft is looking for each slug's language template and not the English one? </p>

<p>Do we need to duplicate each template or?</p>

<p>Thanks in advance.</p>

CC BY-SA 3.0
2014-09-08T10:41:25.890Z
Can you clarify, do you want the url to be localized (/projects for english, /projekte for german), or not? And are you hitting the template directly, or is it used by one of your sections?
André Elvan
CC BY-SA 3.0
2014-09-08T11:34:44.267Z
hey im using projekte/ and projects/ as slug...but my template is called _projects.html...and for the german section.... a 404 is brought up...(because there isnt a _projekte.html)...i just want 1 template to be used for all languages
nexflo
<templating><localization>
Don't use localized slugs for templates
# Don't use localized slugs for templates

(Asked by: username_0 on 2014-09-08)

We are building a multilingual site.

We have different domains and slugs for German and English pages/sections i.e. `projects` is called `projekte`...

Right now the template used is called "projects.html" which we want to use for all languages, but Craft is looking for each slug's language template and not the English one?

Do we need to duplicate each template or?

Thanks in advance.

**Tags:** templating, localization

> **Comments:**
> **username_1**: Can you clarify, do you want the url to be localized (/projects for english, /projekte for german), or not? And are you hitting the template directly, or is it used by one of your sections?  
> **username_0**: hey im using projekte/ and projects/ as slug...but my template is called _projects.html...and for the german section.... a 404 is brought up...(because there isnt a _projekte.html)...i just want 1 template to be used for all languages  

---

## 2 answers

### Answer by username_2 on 2014-09-08. Score: 4 | Accepted answer

You can create new template files for your second locale and simply use Twig include to only maintain one template for all of your locales.
projekte.html:
{% include 'projects.html' %}

Use a locale specific subfolder (craft/templates/de/) to separate the german templates from your main / first locale templates (see the Template Localization article in the Docs on how this works).
Another way to handle localized URIs is to not use "URI to template matching" (pt. 6 in the Routing article) but configure an entry that loads your template instead (pt. 4). 
Create a single section with "projects.html" for the template that should get loaded if the single's URL is requested. The template's filename is irrelevant for the URI matching and you can set the entry's slug to whatever you want in both of your locales.
Before creating many single sections now, also consider using a "Pages" structure section instead.


---

### Answer by username_0 on 2014-09-09. Score: 0

I changed the /page/_entry to:
                {% include ["pages/_#{subpage.type}", "pages/_#{subpage.slug}.html", "pages/_#{subpage.id}.html", 'pages/_default.html'] with {entry: subpage} %}

This way it first uses the page type, then the slug, then the id and at last the default page.
This allows for easy localized templating with using the same templates.
Thanx @carls


---

