Compare commits
22 Commits
Author | SHA1 | Date |
---|---|---|
Steve Boyd | ed155503d2 | |
Steve Boyd | 8fee2b2372 | |
Steve Boyd | 6a191b09f9 | |
Maxime Rainville | d168dc7830 | |
Sam Minnee | 97379fc92b | |
Sam Minnee | ae1155cd04 | |
Ingo Schommer | a8385e1f43 | |
Maxime Rainville | 23a6c875e6 | |
Aaron Carlino | bed7d9a068 | |
Aaron Carlino | 2f4fc13743 | |
Aaron Carlino | 9b89384aa2 | |
Guy Marriott | 7806356ddc | |
Robbie Averill | a353d52372 | |
Robbie Averill | bff0c63b4f | |
Robbie Averill | f761674834 | |
Robbie Averill | 78694caff3 | |
Robbie Averill | 220e49271c | |
Guy Marriott | 34e5b0bc60 | |
Robbie Averill | c09866f586 | |
Robbie Averill | 43b44f4800 | |
wernerkrauss | 66593d8bb3 | |
Robbie Averill | dfa1c965a5 |
|
@ -0,0 +1,14 @@
|
|||
name: Build Docs
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '2.1'
|
||||
paths:
|
||||
- 'docs/en/userguide/**'
|
||||
jobs:
|
||||
build:
|
||||
name: build-docs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Run build hook
|
||||
run: curl -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.NETLIFY_BUILD_HOOK }}
|
27
.travis.yml
27
.travis.yml
|
@ -1,27 +1,26 @@
|
|||
# See https://github.com/silverstripe-labs/silverstripe-travis-support for setup details
|
||||
# See https://github.com/silverstripe/silverstripe-travis-support for setup details
|
||||
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.6
|
||||
|
||||
env:
|
||||
- DB=MYSQL CORE_RELEASE=3
|
||||
dist: trusty
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- php: 5.6
|
||||
env: DB=PGSQL CORE_RELEASE=3
|
||||
- php: 5.6
|
||||
env: DB=MYSQL CORE_RELEASE=3
|
||||
- php: '7.1'
|
||||
env: DB=PGSQL CORE_RELEASE=3.7
|
||||
- php: '7.1'
|
||||
env: DB=MYSQL CORE_RELEASE=3.7
|
||||
- php: '7.2'
|
||||
env: DB=MYSQL CORE_RELEASE=3.7
|
||||
- php: '7.3'
|
||||
env: DB=MYSQL CORE_RELEASE=3.7
|
||||
|
||||
before_script:
|
||||
- pear -q install --onlyreqdeps pear/PHP_CodeSniffer
|
||||
- phpenv rehash
|
||||
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
|
||||
- git clone git://github.com/silverstripe/silverstripe-travis-support.git ~/travis-support
|
||||
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
|
||||
- cd ~/builds/ss
|
||||
|
||||
script:
|
||||
- vendor/bin/phpunit translatable/tests/
|
||||
- phpcs --encoding=utf-8 --tab-width=4 --standard=translatable/tests/phpcs -np translatable
|
||||
- vendor/bin/phpunit translatable/tests
|
||||
- vendor/bin/phpcs --encoding=utf-8 --tab-width=4 --standard=translatable/tests/phpcs -np translatable
|
||||
|
|
10
README.md
10
README.md
|
@ -1,3 +1,9 @@
|
|||
# IMPORTANT NOTE
|
||||
|
||||
Silverstripe Translatable is only compatible with Silverstripe CMS 3. [Silverstripe CMS 3 has entered limited support in June 2018](https://www.silverstripe.org/blog/update-on-silverstripe-5-x/). This means we'll only be fixing critical bugs and security issues for Silverstripe CMS 3 going forward. This applies to _Translatable_ as well.
|
||||
|
||||
[`silverstripe/fluent`](https://github.com/tractorcow-farm/silverstripe-fluent) is the recommended alternative for Silverstripe CMS 4.
|
||||
|
||||
# Translatable module for SilverStripe CMS #
|
||||
|
||||
[![Build Status](https://secure.travis-ci.org/silverstripe/silverstripe-translatable.png?branch=2.1)](http://travis-ci.org/silverstripe/silverstripe-translatable)
|
||||
|
@ -28,7 +34,7 @@ third party translation interface, transifex.com.
|
|||
Newly added strings will be periodically uploaded there for translation,
|
||||
and any new translations will be merged back to the project source code.
|
||||
|
||||
Please use [https://www.transifex.com/projects/p/silverstripe-translatable/](https://www.transifex.com/projects/p/silverstripe-translatable/) to contribute translations,
|
||||
Please use [https://www.transifex.com/silverstripe/silverstripe-translatable/](https://www.transifex.com/projects/p/silverstripe-translatable/) to contribute translations,
|
||||
rather than sending pull requests with YAML files.
|
||||
|
||||
See the ["i18n" topic](http://doc.silverstripe.org/framework/en/trunk/topics/i18n) on doc.silverstripe.org for more details.
|
||||
See the ["i18n" topic](https://docs.silverstripe.org/en/3/developer_guides/i18n/) on doc.silverstripe.org for more details.
|
||||
|
|
|
@ -1473,6 +1473,11 @@ class Translatable extends DataExtension implements PermissionProvider {
|
|||
$urlSegment = $newTranslation->URLSegment;
|
||||
}
|
||||
|
||||
if (URLSegmentFilter::singleton()->getAllowMultibyte()) {
|
||||
// Decode the URL segment, it will be re-encoded again on write
|
||||
$urlSegment = rawurldecode($urlSegment);
|
||||
}
|
||||
|
||||
// Only make segment unique if it should be enforced
|
||||
if(Config::inst()->get('Translatable', 'enforce_global_unique_urls')) {
|
||||
$newTranslation->URLSegment = $urlSegment . '-' . i18n::convert_rfc1766($locale);
|
||||
|
|
|
@ -24,10 +24,8 @@
|
|||
"silverstripe/cms": "~3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"silverstripe/postgresql": "*",
|
||||
"silverstripe/sqlite3": "*",
|
||||
"silverstripe/mssql": "*",
|
||||
"phpunit/PHPUnit": "~3.7@stable"
|
||||
"phpunit/phpunit": "^5.7",
|
||||
"squizlabs/php_codesniffer": "^3.0"
|
||||
},
|
||||
"extra": {
|
||||
"screenshots": [
|
||||
|
@ -38,4 +36,4 @@
|
|||
"issues": "https://github.com/silverstripe/silverstripe-translatable/issues?state=open"
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
The SilverStripe Translatable module allows you to create and edit multiple pages in various languages. This module also adds the ability for your users to select which language of a page they wish to view.
|
||||
|
||||
<div class="note" markdown="1">
|
||||
[note]
|
||||
Notes:
|
||||
|
||||
The SilverStripe Translatable module does not translate content automatically, content authors will need to enter the translated content manually for each translated page.
|
||||
</div>
|
||||
[/note]
|
||||
|
||||
To begin translating content select a page in your site tree from the "Pages" admin. You can see in the below image:
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
---
|
||||
title: Working with translations
|
||||
summary: Adding translated content to your website.
|
||||
---
|
||||
|
||||
# Working with translations
|
||||
|
||||
|
|
|
@ -459,7 +459,32 @@ class TranslatableTest extends FunctionalTest {
|
|||
Config::inst()->update('Translatable', 'enforce_global_unique_urls', true);
|
||||
Translatable::set_current_locale('en_US');
|
||||
}
|
||||
|
||||
|
||||
public function testMultibyteUrlsWorkWhenTranslated()
|
||||
{
|
||||
Config::inst()->update('URLSegmentFilter', 'default_allow_multibyte', true);
|
||||
|
||||
$page = new Page();
|
||||
$page->URLSegment = 'schön-döner';
|
||||
$page->Content = 'Kebabs in Berlin are amazing.';
|
||||
$page->write();
|
||||
$page->doPublish();
|
||||
|
||||
$translatedPage = $page->createTranslation('de_DE');
|
||||
$translatedPage->Content = 'Döner in Berlin sind unglaublich';
|
||||
$translatedPage->doPublish();
|
||||
$this->assertSame('schön-döner-de-de', rawurldecode($translatedPage->URLSegment));
|
||||
|
||||
// Test pinging the page on the frontend
|
||||
$pageResult = $this->get('schön-döner');
|
||||
$this->assertEquals(200, $pageResult->getStatusCode());
|
||||
$this->assertContains('Kebabs in Berlin', (string) $pageResult->getBody());
|
||||
|
||||
$translatedPageResult = $this->get('schön-döner-de-de');
|
||||
$this->assertEquals(200, $translatedPageResult->getStatusCode());
|
||||
$this->assertContains('Döner in Berlin', (string) $translatedPageResult->getBody());
|
||||
}
|
||||
|
||||
function testUpdateCMSFieldsOnSiteTree() {
|
||||
$pageOrigLang = new TranslatableTest_Page();
|
||||
$pageOrigLang->write();
|
||||
|
|
Loading…
Reference in New Issue