9

Yes. You can see all of the arguments the |t filter supports by looking at the docs for Craft::t(), the function that |t maps to. Its $language argument defines the target language translation to use. So in your case you could do this: {{ "Leer esta página en Español"|t(language="es") }}


9

It actually used to work this way when Craft first launched, but we had feedback where it was desired behavior to allow accented characters and even multi-byte characters in slugs, because they are perfectly valid in the URI. e.g. http://domain.com/會意字 However, enough people have brought it up where they would like the old behavior that we're going to add ...


7

If you're running Craft Personal or Client, you'll need to go to the craft_locales table in your database and change the locale to one of the support Craft control panel translations (http://buildwithcraft.com/help/cp-languages). If you're running Craft Pro, you can go to Settings->Locales and add (and re-order) new locales to your site. Then you can go to ...


5

Here is what i have done. Not sure if it helps you. I can't add comments. So here you go. This is based on geo plugin Plugin serviceclass: //to get local ele private function getLocalElement() { $source=craft()->request->getRequestUri(); if($source==''){ $source = 'home'; } return craft()->elements->...


5

Well that was easy enough. I had forgotten about the .htaccess in the subfolders. Everything works like planned now. public/.htaccess (redirects to craft.php if file doesn't exist) public/index.html (splash page) public/craft.php (craft loader) public/fr/.htaccess (redirects to index.php if file doesn't exist) public/fr/index.php (craft loader for french)...


4

If your main language site is dutch for example, you can do that using your own php files locale and naming them according the other locales languages, en.php, fr.php and put those files in craft/translations/ (a folder you must create yourself). Then you can translate in the array all your string (field name and instructions). Have a check at the ...


3

Have a look at the video about the localization feature on the Craft Feature page, this should give you a really good impression on how it works. There's one thing though, that I'd really like to see improved: a way to see which content is still the same across all locales and a way to keep content of a field in sync after the first entry save. See this ...


3

This is a bug in the latest version of Craft specific to Norwegian locales that will be fixed in the next (post 2.3.2643) release.


3

This solutions works for any locale, even if you don't have it installed as a front-end locale. It also works for Personal or Client Craft installs. Add a translations file into craft/translations/xx.php named after the currently selected user locale or system locale for Craft Personal installs and use this code to include any locale's translations you want....


3

Well, the problem was that I was posting my Ajax request to / from all languages, therefore the site replied back with the site main language, which was French in my case. The following finally works: // Get the proper url to post to if ( '{{ craft.i18n.getCurrentLocale() }}' == '{{ craft.i18n.getPrimarySiteLocale() }}' { var url = '/'; } else { ...


3

Completely, 100% untested, but I think you'd be able to pull it off with a pretty simple plugin that added a new Twig filter (check the Twig Extensions switch). From a template you'd something like: {{ myDate|myDateFilter('es') }} Then your plugin's myDateFilter method would do something like: public function myDateFilter(\Twig_Environment $env, $date, $...


3

We recently built our first multi lingual site on craft and used FeedMe to import our entries. What we did was to set up fields such as enDesc, deDesc, svDesc. Then when we imported our entries into craft mapping all of our multi lingual content to be spread across these fields in a single locale. Once this was done we then ran a script across the database ...


3

Is it possible to have the Japanese and English version disabled by default? Yes. Visit Settings -> Sections -> [Your Section Name] inside the Control Panel. Under the heading Which locales should entries in this section target? there's a Default Entry Status Lightswitch for each locale. Make sure the Lightswitches are off (i.e., not green) for the English ...


3

The site.language attribute is just a string, i.e. the language code or locale ID, e.g. 'en'. To get the native name you'll need to go through the I18N service to pull the actual Locale object via that locale ID: {% set locale = craft.app.i18n.getLocaleById(lang.language) %} <a href="{{url}}">{{ locale.nativeName }}</a> Edit: As @Dr_Codswallop ...


3

You can do this using a custom translations file for Commerce and override some of the default translation strings. Go to vendor/commerce/translation/[your-language].php Review the instances of the word you want to translate (could be a lot) In your project root, create a directory called translations Inside of this directory create a directory with your ...


2

You have one Craft install and one DB. Do everything described in that article, just replace the subfolder paths with the different domains: return array( // ... 'siteUrl' => array( 'en' => 'http://example.com/', 'es' => 'http://example.es/', ), ); Then all you have to do is to configure your webhost so that it routes ...


2

There may be a better answer, or one forthcoming, but why don't you try using translation files? Note that the translations in the file can be any phrase, not just single words, so should fit well here. Craft doc on translation files I suspect this will work simply if you add the | t within the errorList macro at the to of the example contact form: ...


2

I don't know if you re-use the fields you're using in that channel in other sections and if you do, my suggestion might not work for you, but here's what you could do: Set all fields to be "not translatable" and if content is entered in one locale it will get synced to all locales. Thereby all required fields will always be filled out and disabling ...


2

Question can be deleted, just found my mistake... Apparently I've forgot to create the 'fr' folder and the index.php etc.. Working like a charm now! Post, can be deleted as it won't be helping others


2

One issue may be that your javascript is requesting a specific url as defined from the site root, thus not giving craft the opportunity to do it's locale routing magic (keep in mind the url for languages other than the default locale may actually be '/no/loadmore.html' — or however you have defined the locale routes in your config settings). So just changing ...


2

I recently released Country Redirect, a plugin that handles this smoothly: https://superbig.co/plugins/country-redirect It lets you map which countries get redirected to which locales, let visitors override the country, and easily let you create a locale nav based on the country mapping.


2

I think this is partially related to a question I raised recently, even though my site won't have that many languages per country but some countries will have 2 languages. How can I add in new Locales to the locale list? Then you would do something like this in your config return array( 'example.com' => array( 'siteUrl' => array( ...


2

I have accidentally add "return array.." two times in my config/general.php file. I removed one and its working fine now.


2

What I would probably do is to create a new branch in version control that you can deploy to production as long as you have to disable the locales. The reason for this is that there are probably too many things you have to change in code and I wouldn’t want to clutter it with a lot of conditionals. In that new branch you would have to delete the index.php ...


2

How about hiding the language switcher on the front-end?


2

By disabling a locale for an entry you are removing the automatically created route for this entry and locale (→ docs for routing). But what you can do, is to diable the automatic routing (uncheck "Entries in this section have their own URLs" in the section settings) and add the same routes as custom dynamic routes manually. news/{slug} → news/_entry ...


2

It looks like you need Craft Pro and even then it's not possible to have the CP in a language that is not installed as a front-end locale. The (new) defaultCpLanguage setting doesn't change this. See Brad's answers here: Change system language + German locale & English CP language resulting in disappeared entries But to help you with your date problem. ...


2

The Craft/Twig dateFilter that you're using will currently only translate the string into the current locale the site is set to. You could probably write a plugin that added its own Twig Extension that added its own filter... let's call it |translatedDate and you could pass in the target locale code as a parameter |translatedDate('en_us'). That filter ...


2

Turns out the issue was my config set incorrectly. I was doing this: 'siteUrl' => array( 'en' => 'http://website.dev/en', 'en-gb' => 'http://website.dev/en-gb', 'en-us' => 'http://website.dev/en-us', 'en-au' => 'http://website.dev/en-au', 'en-nz' => 'http://website.dev/en-nz' ), When the array keys need to match the ...


2

If you go to Settings->Locales in the control panel, you can add "English - en" as a new locale/language to Craft. From there, you can can what language the Control Panel will display on a per user basis by going to the user's account and setting the "Preferring Language" setting. As J. Baptiste pointed out, you can also set what the default Control Panel ...


Only top voted, non community-wiki answers of a minimum length are eligible