Questions tagged [localization]

Locales and multi-lingual translations.

Filter by
Sorted by
Tagged with
25
votes
10answers
7k views

How can I build a language switcher?

I'm currently building a site with two languages, and I need a language switcher so wherever you enter the website you can switch the language easily. I've come this far: {% for locale in craft.i18n....
19
votes
1answer
6k views

How do I output the locale’s name?

When I output {{ craft.locale }} in my template, I get the current locale’s ID (e.g. “en”) rather than its name (e.g. “English”). How do I get the locale’s name?
15
votes
2answers
3k views

How do I create a locale dropdown to switch between languages?

I’m trying to create a dropdown menu to switch between language’s on my site. I am currently doing this with this snippet found on the google plus community: {% block locale__switch %} {# Loop ...
11
votes
2answers
645 views

Can I change the list of available locales?

Is it possible, by any method, to change the list of available locales? The current list includes some strange entries, e.g. East Germany, and we would like to update this to be more current for our ...
9
votes
3answers
1k views

What accurately will set asset paths for multilingual sites?

This is actually a fairly crucial matter, since relative paths definitely won't work with languages, unless you really want all assets in a given Source to be localized or at least copied to each ...
8
votes
2answers
3k views

Multilingual Dates where date format varies

I have a multilingual site, and I want my dates formatted like: English site: July 13, 2014 Italian site: 13 lulgio 2014 So the month name is translated, and the order of the elements changes as ...
8
votes
2answers
323 views

Locale Switch not Affecting News Index Template

So I have successfully set up two locales on my site, with a button to switch between, this works fine for all the sections that have the langauges set, but I cannot seem to get it to work for the ...
7
votes
4answers
1k views

Locale change based on geolocation

I've gotten locales up and running on a site, but would like it to automatically route to domain.com/no for norwegian visitors and domain.com/en for all other visitors. For the life of me, I seem ...
7
votes
2answers
764 views

How to use localized categories properly?

I've setup a localized site (de/en) with custom routing for my categories (which are marked as translatable). I use a tag route for my categories which points to the same template as my structure. ...
7
votes
2answers
342 views

How do you add support to manage content in multiple languages in a plugin with a custom Element Type?

We have a plugin with custom Element Types that allows a user to create a field layout using custom fields. We understand how to setup a localized site and add translation files. This question is ...
6
votes
2answers
1k views

Multi-lingual site navigation made of singles, channels and structure

Does anyone have any examples of how they've put together the main site navigation for a multi-lingual site set-up made up of singles, channels and structure? At the moment I've just hard-coded the ...
6
votes
1answer
554 views

Can I choose a language for the translate filter?

So I've built a language switcher as per this answer. I want the text for each link to be in the native language, for example I want the link to the English locale to say "Read this page in English" ...
6
votes
2answers
204 views

Show a list of recently used tags only from the current locale

I'm having trouble outputting a list of tags that only includes tags from the current locale. Here's the setup: I have a site with two locales: english and spanish I have a section with handle ...
6
votes
1answer
723 views

How do I get the right entry data based on locale and slug?

My site has 2 locales: en_us and nl_nl. I also have a Structure section called Pages, which targets both locales. For each locale, the section has an Entry URL Format: en_us: en/{slug} nl_nl: nl/{...
6
votes
1answer
262 views

Fields applied to the User area are not translatable?

I have a site which allows people to register as a member from the front end. I've got a bunch of fields attached to the User so that each person can build their own extended profile page; the site is ...
5
votes
2answers
2k views

How to add locales in Craft 3

I'm getting started with Craft, using version 3 beta, and I don't find the menu option for adding locales so I guess it's not yet ready but there must be another option. Could anyone guide me through ...
5
votes
3answers
1k views

How do I get Matrix elements to copy their content across language Locales?

I returned to a site designed months ago, and added a second language to it. From the beginning, this site had prominent composition of entries out of multiple elements in their matrix, with ...
5
votes
2answers
624 views

Can globals be localized?

In the multi-lingual site I'm building, I've created an "SEO" global set where my client can enter keywords and a description to populate meta tags site-wide. Problem: globals don't seem to be ...
5
votes
2answers
885 views

Get locale entry.title in other languages

I'm trying to get the locale title (dutch: nl_nl) of an entry, in the english version of the same post. I want to do this so that on hover it shows the English title's Dutch version. Any help is ...
5
votes
2answers
335 views

Possible to change locale in PHP?

I've got a plugin which is defaulting to English during AJAX calls, but I need it to stick to whatever the current language is. I can send the current locale through via AJAX data, but I'm not sure ...
5
votes
1answer
488 views

Is there a way to have checkbox field labels translatable?

So I have a checkbox field in the new entry editor page. Attached image is an example of said checkbox. Just a standard checkbox field. Is there a way for these checkboxes to be translatable? I'm ...
5
votes
2answers
3k views

Locales sub directories on Nginx

I'm trying to get a basic locals sub directory system working on Nginx: /entry - en local. /fr/entry - french translation. /it/entry ect.. Having read this knowledge base article and some other ...
5
votes
2answers
495 views

Licensing a multi-lingual site using different domains

I'm building a site for a multinational company. I have domains set up like this example: acme.com (main portal site, different from local sites, but also aggregating content from all local sites) ...
5
votes
1answer
2k views

Unable to locate message source for category ''

I'm trying to update my plugin to Craft 3 and I'm getting this error message: Unable to locate message source for category ''. What does it mean?!
5
votes
3answers
927 views

Multi-locale pages 404 on subdirectories

I'm developing and running a Craft site locally through Laravel Homestead and am having issues with pages 404'ing in a multi-locale setup. I've followed this guide closely: https://craftcms.com/docs/...
5
votes
1answer
379 views

Output localized urls in navigation

Does {{ url('handle') }} output the right url for localized sites? I have a fr/en site and both lang output the english paths, but shows the right content and language/strings on the page. I'm a bit ...
5
votes
1answer
57 views

How can I localize cpEditUrl?

I use the following code to link to the CP from the front end: {% if entry.isEditable() %} <a href="{{ entry.cpEditUrl }}">Edit entry</a> {% endif %} What do I have to add to link to ...
5
votes
2answers
313 views

Deleted Locale, Entries all gone now

I deleted a locale and checked to transfer all its contents to a different locale, but now the other locale still shows no entries. I'm sure all the entries are still in the database. Any help?
4
votes
5answers
4k views

Craft 3 language switcher

Does anybody successfully implemented a language switch run Craft 3? Trying the Craft 2 variant slightly adjusted but still running into issues: Invalid site handle: nl <ul> {% set otherLocales ...
4
votes
1answer
304 views

What's that |t - filter for?

I found this part of code in the documentation {% set title = "Cocktail Recipes"|t %} What does |t mean there?
4
votes
2answers
5k views

Craft 3: how can I set dynamic Base URL in sites setting?

Sites localized versions are setup using Base URL like this: — http://{baseUrl}/en/ — http://{baseUrl}/fr/ But {baseUrl} variables are not transformed using craft.app.sites.getAllSites(). {% set ...
4
votes
2answers
1k views

How to build a great multi-lingual navigation with channels, structure, and manageable in the CP

I'm working on a complex website with multi locales, channels, structures and different designs per page. And the site needs a breadcrumb path. My client needs to manage and add items the to menu. ...
4
votes
2answers
217 views

Adding new locale - hangs at Step 3 'ResaveAllElements'

I've looked at every option I can think of so hoping that someone can assist. We're on a dedicated server with full root access. We've got a relatively small site that now needs a Spanish locale ...
4
votes
1answer
291 views

Can locales be used to switch layouts?

In my particular case I need to be able to switch the layout that the template extends. Is this possible to do using locales?
4
votes
3answers
1k views

Change page elements based on geolocation

We would like to geolocate visitor IP addresses, and for US-based addresses render a portion of the page to display state-specific options. I actually have the PHP working well to pull the 2-letter ...
4
votes
1answer
780 views

Craft 3 Multi-site with no “default” site

I have setup a Craft 3 multi-site with the following configuration: But what I really want is: Additionally, I want to have a 'default' http://localhost:8888 so I can always redirect to /en or /es ...
4
votes
1answer
87 views

Override admin local name

I changed the language locale to Hungarian, but the translation for the singles looks a bit funny. Is there an easy way to override it with my version? Singles are translated to "Egyedülállók" but ...
4
votes
1answer
514 views

Problems with channel and locales

So I'm setting up a multi-lingual site for the first time, and I'm having some problems with the urls. I followed the guide, step by step. I've set up the siteUrl in general.php: 'DEV' => array( ...
4
votes
1answer
829 views

Getting all entries from all locales

Can anyone confirm if I want to pull back a list of all entries regardless of locale I could do something like craft.entries.locale(null) to get 100% of entries?
4
votes
2answers
802 views

Is it possible to manage language translations without directly accessing the PHP translations file?

It is beautifully described in the docs how to translate static text using translation files. As the client has no access to that file and managing a php array is not what I want them to do, I am ...
4
votes
1answer
419 views

Is it possible to translate the name of a field in the CP?

I have content editors that speaks different languages. Is there a way to translate the name and introduction of a field in the control panel? A simple {{ "value"|t }} seams not to work. Example: ...
4
votes
2answers
881 views

Don't use localized slugs for templates

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....
4
votes
2answers
6k views

Is it possible to output month names in my native language?

I'm doing this: {# Get events from `events` section in desired sort order #} {% set allEvents = craft.entries.section('events').order('eventsDate asc') %} {# Loop through `allEvents` and print the ...
4
votes
1answer
405 views

How to create a query to group alternate language pages?

I'm trying to create a sitemap for a site with multiple locales. An example of the format is described here, but as a quick summary: I need to output locales of related translated pages aside one ...
4
votes
1answer
1k views

Retrieving an entry by ID in ALL locales

I've been looking at How can I build a language switcher? but I don't to hit the DB for each entry in the loop, just to get the entry's localised slug. However I can't see a way to get an entry by ID ...
4
votes
1answer
622 views

Save multiple locale data via plugin

I'm trying to import data from another database using locales, but am having trouble saving the other locale after the primary locale is saved. foreach($row as $data) { $entry = new EntryModel();...
4
votes
1answer
130 views

Fetching localized globals?

I have a site that is mixed English and Chinese. I've properly set up the locale to include Chinese as a locale, and have put Chinese translations for my fields in place. That all works. However, ...
4
votes
2answers
662 views

How to transform German umlauts when creating slugs?

First of all, I want to thank you for creating Craft. It's really one of the best content management systems I have ever worked with. I encountered an issue while working on a multilingual site: ...
4
votes
1answer
1k views

Localization - How do we manage multilingual, multi-environment on multiple domains?

I read this KB article about localization though, the examples are for sub-folders. I'm wondering how to handle the same concept but, for different language based domains e.g. example.com example.mx ...
3
votes
2answers
711 views

How to extract static messages from templates into translation files?

I use Craft on multilingual site and I'm having some difficulty in getting the static messages on templates added or changed on every translation file I have. Is there any way to extract those static ...

1 2 3 4 5 8