Compare commits

...

22 Commits
2.3.2 ... 2

Author SHA1 Message Date
Steve Boyd ed155503d2 Merge branch '2.4' into 2 2021-01-02 11:32:40 +13:00
Steve Boyd 8fee2b2372 Merge branch '2.3' into 2.4 2021-01-02 11:31:18 +13:00
Steve Boyd 6a191b09f9 Merge branch '2.2' into 2.3 2021-01-02 11:30:41 +13:00
Maxime Rainville d168dc7830 Merge branch '2.1' into 2.2 2020-10-15 17:35:15 +13:00
Sam Minnee 97379fc92b MNT: Fix invalid composer.json casing 2020-10-11 16:23:45 +13:00
Sam Minnee ae1155cd04 MNT: Fix invalid composer.json casing 2020-10-11 16:22:57 +13:00
Ingo Schommer a8385e1f43
Merge pull request #286 from open-sausages/pulls/2/warning-of-imminent-anarchy
DOC Add a warnign about support for translatable
2020-08-10 13:18:37 +12:00
Maxime Rainville 23a6c875e6 DOC Add a warnign about support for translatable 2020-08-10 11:54:43 +12:00
Aaron Carlino bed7d9a068
META: Add github action to build docs 2019-12-19 13:49:38 +13:00
Aaron Carlino 2f4fc13743
Merge pull request #284 from silverstripe/pulls/2.1/new-docs
Update userguide for compliance with new docs site
2019-12-19 12:43:34 +13:00
Aaron Carlino 9b89384aa2 Update userguide for compliance with new docs site 2019-12-06 15:03:34 +13:00
Guy Marriott 7806356ddc
Merge branch '2.3' into 2.4 2019-08-01 11:08:29 +12:00
Robbie Averill a353d52372 Merge branch '2.4' into 2 2019-07-23 15:40:03 +02:00
Robbie Averill bff0c63b4f Remove obsolete branch alias 2019-07-23 15:39:17 +02:00
Robbie Averill f761674834 Merge branch '2.3' into 2.4 2019-07-23 15:38:42 +02:00
Robbie Averill 78694caff3 Update Travis builds to include PHP 7 2019-07-23 15:36:05 +02:00
Robbie Averill 220e49271c Merge branch '2.2' into 2.3 2019-07-23 15:33:51 +02:00
Guy Marriott 34e5b0bc60
Merge pull request #283 from creative-commoners/pulls/2.3/multibyte-urls
FIX Translatable now handles multibute URLs when they are enabled
2019-04-05 16:07:38 +13:00
Robbie Averill c09866f586 FIX Translatable now handles multibute URLs when they are enabled 2019-04-05 14:29:03 +13:00
Robbie Averill 43b44f4800
Merge pull request #281 from wernerkrauss/patch-1
Updating links to transifex and docs
2018-08-28 17:31:44 +12:00
wernerkrauss 66593d8bb3
Updating links to transifex and docs
Doc link was broken
2018-08-28 07:21:28 +02:00
Robbie Averill dfa1c965a5 Update branch alias for 2.4.x-dev 2018-02-22 10:27:17 +13:00
8 changed files with 73 additions and 24 deletions

14
.github/workflows/main.yml vendored Normal file
View File

@ -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 }}

View File

@ -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

View File

@ -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.

View File

@ -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);

View File

@ -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"
}
}

View File

@ -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:

View File

@ -1,5 +1,7 @@
---
title: Working with translations
summary: Adding translated content to your website.
---
# Working with translations

View File

@ -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();