{"id":15508363,"url":"https://github.com/yeah/radiant-multilingual-pages-extension","last_synced_at":"2025-03-23T03:33:15.114Z","repository":{"id":631384,"uuid":"272162","full_name":"yeah/radiant-multilingual-pages-extension","owner":"yeah","description":"Radiant Extension. Provides multilingual pages for Radiant.","archived":false,"fork":false,"pushed_at":"2012-02-12T12:35:35.000Z","size":128,"stargazers_count":14,"open_issues_count":4,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T21:34:00.626Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://rocket-rentals.de","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yeah.png","metadata":{"files":{"readme":"README.rdoc","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-08-08T00:15:13.000Z","updated_at":"2019-07-14T12:27:06.000Z","dependencies_parsed_at":"2022-07-07T18:10:56.202Z","dependency_job_id":null,"html_url":"https://github.com/yeah/radiant-multilingual-pages-extension","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeah%2Fradiant-multilingual-pages-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeah%2Fradiant-multilingual-pages-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeah%2Fradiant-multilingual-pages-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeah%2Fradiant-multilingual-pages-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yeah","download_url":"https://codeload.github.com/yeah/radiant-multilingual-pages-extension/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244267475,"owners_count":20425835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T09:37:57.161Z","updated_at":"2025-03-23T03:33:14.746Z","avatar_url":"https://github.com/yeah.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Radiant Multilingual Pages Extension\n\nProvides multilingual pages for Radiant. A multilingual page has one slug for every language. Use slugs like \u003ccode\u003eabout-us-en\u003c/code\u003e, \u003ccode\u003eabout-us-de\u003c/code\u003e or \u003ccode\u003eabout-us\u003c/code\u003e, \u003ccode\u003eueber-uns\u003c/code\u003e and translate away using \u003ccode\u003e\u003cr:translate en=\"Welcome\" de=\"Willkommen\" /\u003e\u003c/code\u003e and \u003ccode\u003e\u003cr:if_language lang=\"en\"\u003e\u003cp\u003eSome english text\u003c/p\u003e\u003c/r:if_language\u003e\u003c/code\u003e.\n\nThis extension is different from the \"Language Redirect\" extension. \"Language Redirect\" expects you to replicate your page tree for every language you use. \"Multilingual Pages\" allows you to define multiple language versions within one single page. \n\nSpecial feature for non-multilingual pages: if you use the multilingual tags in layouts or global snippets, you might want to language-enable non-multilingual pages (blog articles, etc.) as well. Just add \u003ccode\u003e/lang-\u003cyour lang\u003e\u003c/code\u003e to your regular urls and the tags work as if you had called a slug in \u003ccode\u003e\u003cyour lang\u003e\u003c/code\u003e. This is also the preferred way of operation for your home page: simply use \u003ccode\u003e/lang-\u003cyour lang\u003e\u003c/code\u003e instead of \u003ccode\u003e/\u003c/code\u003e.\n\nGood to know: this extension is cache-safe.\n\n== Dependencies\n\nHas been developed with Radiant 0.8, seems to be working with 0.9\n\n== Installation \n\nTo install Multilingual Pages, run: \n\n  ./script/extension install multilingual_pages\n\n== More Help\n\n=== Tags\n\nYou can use multilingual tags everywhere throughout your site, not only on multilingual pages. This is specifically useful for layouts and general snippets. For now, there are three tags: \u003ccode\u003e\u003cr:translate /\u003e\u003c/code\u003e, \u003ccode\u003e\u003cr:if_language\u003e...\u003c/r:if_language\u003e\u003c/code\u003e, and \u003ccode\u003e\u003cr:language_selection\u003e...\u003c/r:language_selection\u003e\u003c/code\u003e. Use them like so:\n\n==== +translate+\n\n  \u003cr:translate en=\"Welcome\" de=\"Willkommen\" /\u003e\n\n==== +if_language+\n  \u003cr:if_language lang=\"en\"\u003e\u003cp\u003eThis is an english paragraph.\u003c/p\u003e\u003c/r:if_language\u003e\n  \u003cr:if_language lang=\"de\"\u003e\u003cp\u003eDies ist ein Absatz auf deutsch.\u003c/p\u003e\u003c/r:if_language\u003e\n\n==== +meta:language+\n  \u003cr:meta:language /\u003e\n\n==== +language_selection+\n\n  \u003cr:language_selection\u003e\n    \u003cr:current\u003e ... \u003cr:language /\u003e ...\u003c/r:current\u003e\n    \u003cr:available\u003e ... \u003cr:url /\u003e ... \u003cr:title /\u003e ... \u003cr:language /\u003e ... \u003c/r:available\u003e\n    \u003cr:unavailable\u003e ... \u003cr:language /\u003e ... \u003c/r:unavailable\u003e\n    \u003cr:between\u003e ... \u003c/r:between\u003e\n  \u003c/r:language_selection\u003e\n\nMore help on tags is available within Radiant using the \"Available Tags\" reference.\n\n=== Language selection using multilingual slugs\n\nThe main feature of this extension are multilingual slugs. A multilingual page can have one or more multilingual slugs. Define them right below the title field of your page like so:\n\n  en=our-staff;de=unsere-mitarbeiter;fr=nos-employes\n\nThis will add three additional slugs resulting in three new ways to call your page: \u003ccode\u003e/home\u003c/code\u003e, \u003ccode\u003e/startseite\u003c/code\u003e, and \u003ccode\u003e/acceuil\u003c/code\u003e. Please note, that your original slug (as defined in the meta section of the page) works as well. It is recommended to not mention the english slug in the multilingual slugs again, even though it would not break anything.\n\nOf course, the multilingual slugs work on multiple levels. You can have multiple nested Mulilingual Pages and they all can have their own multilingual slugs. The Multilingual Pages Extension makes sure you can reach your pages just the way you would with regular Pages. Please note: you can't combine slugs of different languages here. Stuff like\n\n  http://domain.com/company/mitarbeiter/le-directeur\n\ndoes not make sense and will render a 404. These would work, however:\n\n  http://domain.com/company/staff/the-ceo\n  http://domain.com/firma/mitarbeiter/der-geschaeftsfuehrer\n  http://domain.com/entreprise/employes/le-directeur\n\n=== Language selection for non-multilingual pages\n\nThere are pages which can't get multilingual slugs. One of them is the home page (see below), but also pages which come with other extensions won't support the multilingual slugs. This isn't that much of a problem, as there are two ways to cope with this:\n\nLet's say you have a blog using the Archive Extension and you want to offer that in multiple languages. \n\n==== Solution #1: Replicate non-multilingual pages (not very elegant)\n\nAs noted above: it's not very elegant, but works. You would just create one Archive page for each supported language and create blog articles in each language. This way, you could also have different articles in different languages. The downside of this solution: multilingual tags in your layout or general snippets will render/expand in english (or whatever your default language is). You would have to use a different layout and snippets for the replicated pages.\n\n==== Solution #2: Access non-multilingual pages using a route suffix (preferred)\n\nThis is suitable for cases where you're okay with the fact that some of your content is not translated. Maybe, you don't have the staff to write your blog in all supported languages. However, you want the multilingual tags in your layout and general snippets. This case is supported using a route suffix which comes with Multilingual Pages. Just add \u003ccode\u003e/lang-\u003cyour lang\u003e\u003c/code\u003e (e.g. \u003ccode\u003e/lang-de\u003c/code\u003e for german) to any url and the multilingual tags in your page will render/expand in the \u003ccode\u003e\u003cyour lang\u003e\u003c/code\u003e language.\n\nTechnically, you can combine solutions #1 and #2. You could also use multilingual tags in your blog articles when you use the route suffixes, you just won't have urls in your language then.\n\n=== The Home page\n\nThe home page somehow is a special beast. The problem is: it doesn't really have a slug. The slug of your home page is \u003ccode\u003e/\u003c/code\u003e. How do you translate that? Bummer. Route suffixes to the rescue! Just use \u003ccode\u003e/lang-\u003cyour lang\u003e\u003c/code\u003e (e.g. \u003ccode\u003e/lang-de\u003c/code\u003e) instead of \u003ccode\u003e/\u003c/code\u003e to access your home page in your preferred language.\n\n=== Navigation\n\nThe good news: links on your multilingual pages will automatically look for a slug on the target page that matches the current language. Thus, stuff like \n\n  \u003cr:children:each\u003e\n    \u003cr:link/\u003e\n  \u003c/r:children:each\u003e\n\nwill just work as expected.\n\nThe bad news: this does not work with the \u003ccode\u003e\u003cr:navigation\u003e...\u003c/r:navigation\u003e\u003c/code\u003e tag, as it wants you to explicitly specify the urls you'd like to link to. Something like\n\n  \u003cr:navigation urls=\"Products: /products | Blog: /blog | Locations: /locations | About us: /about-us\"\u003e\n    \u003cr:normal\u003e\u003cli\u003e\u003ca href=\"\u003cr:url /\u003e\"\u003e\u003cr:title /\u003e\u003c/a\u003e\u003c/li\u003e\u003c/r:normal\u003e\n    \u003cr:here\u003e\u003cli\u003e\u003ca class=\"active\" href=\"\u003cr:url /\u003e\"\u003e\u003cr:title /\u003e\u003c/a\u003e\u003c/li\u003e\u003c/r:here\u003e\n    \u003cr:selected\u003e\u003cli\u003e\u003ca class=\"active\" href=\"\u003cr:url /\u003e\"\u003e\u003cr:title /\u003e\u003c/a\u003e\u003c/li\u003e\u003c/r:selected\u003e\n  \u003c/r:navigation\u003e\n\nwould have to become:\n\n  \u003cr:if_language lang=\"en\"\u003e\n    \u003cr:navigation urls=\"Products: /products | Blog: /blog | Locations: /locations | About us: /about-us\"\u003e\n      \u003cr:normal\u003e\u003cli\u003e\u003ca href=\"\u003cr:url /\u003e\"\u003e\u003cr:title /\u003e\u003c/a\u003e\u003c/li\u003e\u003c/r:normal\u003e\n      \u003cr:here\u003e\u003cli\u003e\u003ca class=\"active\" href=\"\u003cr:url /\u003e\"\u003e\u003cr:title /\u003e\u003c/a\u003e\u003c/li\u003e\u003c/r:here\u003e\n      \u003cr:selected\u003e\u003cli\u003e\u003ca class=\"active\" href=\"\u003cr:url /\u003e\"\u003e\u003cr:title /\u003e\u003c/a\u003e\u003c/li\u003e\u003c/r:selected\u003e\n    \u003c/r:navigation\u003e\n  \u003c/r:if_language\u003e\n  \u003cr:if_language lang=\"de\"\u003e\n    \u003cr:navigation urls=\"Produkte: /produkte | Blog: /blog/lang-de | Filialen: /filialen | Über uns: /ueber-uns\"\u003e\n      \u003cr:normal\u003e\u003cli\u003e\u003ca href=\"\u003cr:url /\u003e\"\u003e\u003cr:title /\u003e\u003c/a\u003e\u003c/li\u003e\u003c/r:normal\u003e\n      \u003cr:here\u003e\u003cli\u003e\u003ca class=\"active\" href=\"\u003cr:url /\u003e\"\u003e\u003cr:title /\u003e\u003c/a\u003e\u003c/li\u003e\u003c/r:here\u003e\n      \u003cr:selected\u003e\u003cli\u003e\u003ca class=\"active\" href=\"\u003cr:url /\u003e\"\u003e\u003cr:title /\u003e\u003c/a\u003e\u003c/li\u003e\u003c/r:selected\u003e\n    \u003c/r:navigation\u003e\n  \u003c/r:if_language\u003e\n\nThat's not the prettiest thing in the World but it works. Please note, that we made use of the route suffix for the blog here as described above.\n\n=== Language selection (aka \"flag links\")\n\nOf course, you want those nice little flags on your web site as soon as you have Multilingual Pages in place, don't you? Well, look no further, here comes \u003ccode\u003e\u003cr:language_selection\u003e...\u003c/r:language_selection\u003e\u003c/code\u003e. It behaves similar to Radiant's \u003ccode\u003e\u003cr:navigation\u003e...\u003c/r:navigation\u003e\u003c/code\u003e so it should be easy to understand and implement. Here are two examples, one for flags (yay, flags!) and one for a select box.\n\n==== Flags\n\n  \u003cr:language_selection\u003e\n    \u003cr:current\u003e\n      \u003cimg src=\"/images/flags/\u003cr:language /\u003e.png\" /\u003e\n    \u003c/r:current\u003e\n    \u003cr:available\u003e\n      \u003ca href=\"\u003cr:url /\u003e\" title=\"\u003cr:title /\u003e\"\u003e\u003cimg src=\"/images/flags/\u003cr:language /\u003e-inactive.png\" /\u003e\u003c/a\u003e\n    \u003c/r:available\u003e\n    \u003cr:unavailable\u003e\n      \u003cimg src=\"/images/flags/\u003cr:language /\u003e-strikethrough.png\" /\u003e\n    \u003c/r:unavailable\u003e\n    \u003cr:between\u003e\u0026nbsp;\u003c/r:between\u003e\n  \u003c/r:language_selection\u003e\n\n(You can get very nice flag icons for free from http://www.famfamfam.com/lab/icons/silk.)\n\n==== Select box\n\n  \u003cselect onchange=\"location.href=this.value;\"\u003e\n    \u003cr:language_selection\u003e\n      \u003cr:current\u003e\n        \u003coption selected=\"selected\" value=\"\u003cr:url /\u003e\"\u003e\u003cr:language_name /\u003e\u003c/option\u003e\n      \u003c/r:current\u003e\n      \u003cr:available\u003e\n        \u003coption value=\"\u003cr:url /\u003e\"\u003e\u003cr:language_name /\u003e\u003c/option\u003e\n      \u003c/r:available\u003e\n      \u003cr:unavailable\u003e\n        \u003coption disabled=\"disabled\" value=\"\u003cr:url /\u003e\"\u003e\u003cr:language_name /\u003e\u003c/option\u003e\n      \u003c/r:unavailable\u003e\n    \u003c/r:language_selection\u003e\n  \u003c/select\u003e\n\n=== Language detection\n\nAlright, language selection is great, but you want your first time users to see the right page according to their \u003ccode\u003eAccept-Language\u003c/code\u003e headers, don't you? Perfect, because that's what Mulilingual Pages does out of the box. If the home page is accessed using the basic slug \u003ccode\u003e/\u003c/code\u003e, language detection will redirect the user to the right language version using the route suffix.\n\nIf that's not what you like, you can always disable this feature by setting the \u003ccode\u003emultilingual.use_language_detection\u003c/code\u003e config option to \u003ccode\u003efalse\u003c/code\u003e.\n\n=== Meta tag\n\nFor various reasons (SEO being one), it is good practice to include a \u003ccode\u003e\u003cmeta /\u003e\u003c/code\u003e tag on every page revealing the current language the page is written in. Just add \u003ccode\u003e\u003cr:meta:language /\u003e\u003c/code\u003e to the \u003ccode\u003e\u003chead /\u003e\u003c/code\u003e section of your layout and you're done.\n\n== Configuration option reference\n\nConfiguration options are stored in Radiant's \u003ccode\u003econfig\u003c/code\u003e table and are prefixed with \u003ccode\u003emultilingual.\u003c/code\u003e, so they should be easy to spot. The following options are available:\n\n* \u003ccode\u003enon_multilingual_route\u003c/code\u003e: The first part of the route suffix which is used for non-multilingual pages. Can be set to \u003ccode\u003e''\u003c/code\u003e (the empty string) in order to just append the two-character language code to non-multilingual routes. But beware: if you have slugs with only two characters, you might get in trouble and you'd better set \u003ccode\u003enon_multilingual_route\u003c/code\u003e to something like \u003ccode\u003elang-\u003c/code\u003e. (Default: \u003ccode\u003elang-\u003c/code\u003e)\n\n* \u003ccode\u003edefault_language\u003c/code\u003e: The default language that is used when nothing else is found. (Default: \u003ccode\u003een\u003c/code\u003e)\n\n* \u003ccode\u003emeta_part_name\u003c/code\u003e: The name of the page parts that are added to multilingual pages and which are used to specify multilingual meta information like title, breadcrumbs, etc. (Default: \u003ccode\u003emultilingual meta\u003c/code\u003e)\n\n* \u003ccode\u003eavailable_languages\u003c/code\u003e: A comma separated list of available languages throughout your site, used for \u003ccode\u003e\u003cr:language_selection\u003e...\u003c/r:language_selection\u003e\u003c/code\u003e and other things. Every time you add a multilingual slug to a multilingual page, its two character language code is automatically appended to this list for you. If you remove a language version, you'd have to remove it from this list as well, in order for it to disappear form language selection menus. You can also re-order the languages here, language selection will follow the order of this list. (Default: \u003ccode\u003een\u003c/code\u003e and evolving with your multilingual slugs)\n\n* \u003ccode\u003euse_language_detection\u003c/code\u003e: Use this switch to turn language detection (see above) on or off. (Default: \u003ccode\u003etrue\u003c/code\u003e)\n\n== Version\n\n0.5\n\n== Licence\n\nMIT\n\n== Credits\n\n* The language detection feature borrows concept and code from the Language Redirect extension, http://wiki.github.com/radiant/radiant/language-redirect-extension\n* The list of languages is taken from Wikipedia, http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes\n\n== Contributors\n\n* Jan Schulz-Hofen\n\nIf you contribute, go ahead and add your name to the list!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeah%2Fradiant-multilingual-pages-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyeah%2Fradiant-multilingual-pages-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeah%2Fradiant-multilingual-pages-extension/lists"}