Merge branch '2.3' into 2.4

This commit is contained in:
Robbie Averill 2019-07-23 15:38:42 +02:00
parent dfa1c965a5
commit f761674834
28 changed files with 245 additions and 148 deletions

View File

@ -1,29 +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 language: php
php: dist: trusty
- 5.3
env:
- DB=MYSQL CORE_RELEASE=3
matrix: matrix:
include: include:
- php: 5.4 - php: '7.1'
env: DB=PGSQL CORE_RELEASE=3 env: DB=PGSQL CORE_RELEASE=3.7
- php: 5.5 - php: '7.1'
env: DB=MYSQL CORE_RELEASE=3.2 env: DB=MYSQL CORE_RELEASE=3.7
- php: 5.6 - php: '7.2'
env: DB=MYSQL CORE_RELEASE=3.2 env: DB=MYSQL CORE_RELEASE=3.7
- php: '7.3'
env: DB=MYSQL CORE_RELEASE=3.7
before_script: before_script:
- pear -q install --onlyreqdeps pear/PHP_CodeSniffer
- phpenv rehash - 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 - php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
- cd ~/builds/ss - cd ~/builds/ss
script: script:
- vendor/bin/phpunit translatable/tests/ - vendor/bin/phpunit translatable/tests
- phpcs --encoding=utf-8 --tab-width=4 --standard=translatable/tests/phpcs -np translatable - vendor/bin/phpcs --encoding=utf-8 --tab-width=4 --standard=translatable/tests/phpcs -np translatable

View File

@ -1,6 +1,7 @@
# Translatable module for SilverStripe CMS # # 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) [![Build Status](https://secure.travis-ci.org/silverstripe/silverstripe-translatable.png?branch=2.1)](http://travis-ci.org/silverstripe/silverstripe-translatable)
[![SilverStripe supported module](https://img.shields.io/badge/silverstripe-supported-0071C4.svg)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/)
## Introduction ## ## Introduction ##
@ -27,7 +28,7 @@ third party translation interface, transifex.com.
Newly added strings will be periodically uploaded there for translation, Newly added strings will be periodically uploaded there for translation,
and any new translations will be merged back to the project source code. 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. 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

@ -21,7 +21,7 @@ class LanguageDropdownField extends GroupedDropdownField {
* @param string $list Indicates the source language list. * @param string $list Indicates the source language list.
* Can be either Common-English, Common-Native, Locale-English, Locale-Native * Can be either Common-English, Common-Native, Locale-English, Locale-Native
*/ */
function __construct($name, $title, $excludeLocales = array(), public function __construct($name, $title = null, $excludeLocales = array(),
$translatingClass = 'SiteTree', $list = 'Common-English', $instance = null $translatingClass = 'SiteTree', $list = 'Common-English', $instance = null
) { ) {
$usedLocalesWithTitle = Translatable::get_existing_content_languages($translatingClass); $usedLocalesWithTitle = Translatable::get_existing_content_languages($translatingClass);

View File

@ -743,7 +743,12 @@ class Translatable extends DataExtension implements PermissionProvider {
if(!$obj || $obj->ObsoleteClassName) continue; if(!$obj || $obj->ObsoleteClassName) continue;
$obj->Locale = Translatable::default_locale(); $obj->Locale = Translatable::default_locale();
$obj->writeToStage($stage);
$oldMode = Versioned::get_reading_mode();
Versioned::reading_stage($stage);
$obj->writeWithoutVersion();
Versioned::set_reading_mode($oldMode);
$obj->addTranslationGroup($obj->ID); $obj->addTranslationGroup($obj->ID);
$obj->destroy(); $obj->destroy();
unset($obj); unset($obj);
@ -928,13 +933,7 @@ class Translatable extends DataExtension implements PermissionProvider {
// This is to prevent the overhead of writing all translations when // This is to prevent the overhead of writing all translations when
// the class didn't actually change. // the class didn't actually change.
$baseDataClass = ClassInfo::baseDataClass($this->owner->class); $baseDataClass = ClassInfo::baseDataClass($this->owner->class);
$currentStage = Versioned::current_stage(); $fresh = DataObject::get($baseDataClass)->byId($this->owner->ID);
$fresh = Versioned::get_one_by_stage(
$baseDataClass,
Versioned::current_stage(),
'"ID" = ' . $this->owner->ID,
null
);
if ($fresh) { if ($fresh) {
$changed = $changedFields['ClassName']['after'] != $fresh->ClassName; $changed = $changedFields['ClassName']['after'] != $fresh->ClassName;
} }
@ -1065,72 +1064,74 @@ class Translatable extends DataExtension implements PermissionProvider {
$alreadyTranslatedLocales[$this->owner->Locale] = $this->owner->Locale; $alreadyTranslatedLocales[$this->owner->Locale] = $this->owner->Locale;
$alreadyTranslatedLocales = array_combine($alreadyTranslatedLocales, $alreadyTranslatedLocales); $alreadyTranslatedLocales = array_combine($alreadyTranslatedLocales, $alreadyTranslatedLocales);
// Check if fields exist already to avoid adding them twice on repeat invocations if ($fields->hasTabSet()) {
$tab = $fields->findOrMakeTab('Root.Translations', _t('Translatable.TRANSLATIONS', 'Translations')); // Check if fields exist already to avoid adding them twice on repeat invocations
if(!$tab->fieldByName('CreateTransHeader')) { $tab = $fields->findOrMakeTab('Root.Translations', _t('Translatable.TRANSLATIONS', 'Translations'));
$tab->push(new HeaderField( if(!$tab->fieldByName('CreateTransHeader')) {
'CreateTransHeader', $tab->push(new HeaderField(
_t('Translatable.CREATE', 'Create new translation'), 'CreateTransHeader',
2 _t('Translatable.CREATE', 'Create new translation'),
)); 2
}
if(!$tab->fieldByName('NewTransLang') && !$tab->fieldByName('AllTransCreated')) {
$langDropdown = LanguageDropdownField::create(
"NewTransLang",
_t('Translatable.NEWLANGUAGE', 'New language'),
$alreadyTranslatedLocales,
'SiteTree',
'Locale-English',
$this->owner
)->addExtraClass('languageDropdown no-change-track');
$tab->push($langDropdown);
$canAddLocale = (count($langDropdown->getSource()) > 0);
if($canAddLocale) {
// Only add create button if new languages are available
$tab->push(
$createButton = InlineFormAction::create(
'createtranslation',
_t('Translatable.CREATEBUTTON', 'Create')
)->addExtraClass('createTranslationButton')
);
$createButton->includeDefaultJS(false); // not fluent API...
} else {
$tab->removeByName('NewTransLang');
$tab->push(new LiteralField(
'AllTransCreated',
_t('Translatable.ALLCREATED', 'All allowed translations have been created.')
)); ));
} }
} if(!$tab->fieldByName('NewTransLang') && !$tab->fieldByName('AllTransCreated')) {
if($alreadyTranslatedLocales) { $langDropdown = LanguageDropdownField::create(
if(!$tab->fieldByName('ExistingTransHeader')) { "NewTransLang",
$tab->push(new HeaderField( _t('Translatable.NEWLANGUAGE', 'New language'),
'ExistingTransHeader', $alreadyTranslatedLocales,
_t('Translatable.EXISTING', 'Existing translations'), 'SiteTree',
3 'Locale-English',
)); $this->owner
if (!$tab->fieldByName('existingtrans')) { )->addExtraClass('languageDropdown no-change-track');
$existingTransHTML = '<ul>'; $tab->push($langDropdown);
if ($existingTranslations = $this->getTranslations()) { $canAddLocale = (count($langDropdown->getSource()) > 0);
foreach ($existingTranslations as $existingTranslation) {
if ($existingTranslation && $existingTranslation->hasMethod('CMSEditLink')) { if($canAddLocale) {
$existingTransHTML .= sprintf( // Only add create button if new languages are available
'<li><a href="%s">%s</a></li>', $tab->push(
Controller::join_links( $createButton = InlineFormAction::create(
$existingTranslation->CMSEditLink(), 'createtranslation',
'?Locale=' . $existingTranslation->Locale _t('Translatable.CREATEBUTTON', 'Create')
), )->addExtraClass('createTranslationButton')
i18n::get_locale_name($existingTranslation->Locale) );
); $createButton->includeDefaultJS(false); // not fluent API...
} } else {
} $tab->removeByName('NewTransLang');
} $tab->push(new LiteralField(
$existingTransHTML .= '</ul>'; 'AllTransCreated',
$tab->push(new LiteralField('existingtrans', $existingTransHTML)); _t('Translatable.ALLCREATED', 'All allowed translations have been created.')
));
} }
} }
} if($alreadyTranslatedLocales) {
if(!$tab->fieldByName('ExistingTransHeader')) {
$tab->push(new HeaderField(
'ExistingTransHeader',
_t('Translatable.EXISTING', 'Existing translations'),
3
));
if (!$tab->fieldByName('existingtrans')) {
$existingTransHTML = '<ul>';
if ($existingTranslations = $this->getTranslations()) {
foreach ($existingTranslations as $existingTranslation) {
if ($existingTranslation && $existingTranslation->hasMethod('CMSEditLink')) {
$existingTransHTML .= sprintf(
'<li><a href="%s">%s</a></li>',
Controller::join_links(
$existingTranslation->CMSEditLink(),
'?Locale=' . $existingTranslation->Locale
),
i18n::get_locale_name($existingTranslation->Locale)
);
}
}
}
$existingTransHTML .= '</ul>';
$tab->push(new LiteralField('existingtrans', $existingTransHTML));
}
}
}
}
} }
function updateSettingsFields(&$fields) { function updateSettingsFields(&$fields) {
@ -1293,20 +1294,16 @@ class Translatable extends DataExtension implements PermissionProvider {
// exclude the language of the current owner // exclude the language of the current owner
$filter .= sprintf(' AND "%s"."Locale" != \'%s\'', $baseDataClass, $this->owner->Locale); $filter .= sprintf(' AND "%s"."Locale" != \'%s\'', $baseDataClass, $this->owner->Locale);
} }
$currentStage = Versioned::current_stage();
$joinOnClause = sprintf('"%s_translationgroups"."OriginalID" = "%s"."ID"', $baseDataClass, $baseDataClass); $joinOnClause = sprintf('"%s_translationgroups"."OriginalID" = "%s"."ID"', $baseDataClass, $baseDataClass);
if($this->owner->hasExtension("Versioned")) { if($this->owner->hasExtension("Versioned") && $stage) {
if($stage) Versioned::reading_stage($stage);
$translations = Versioned::get_by_stage( $translations = Versioned::get_by_stage(
$baseDataClass, $baseDataClass,
Versioned::current_stage(), $stage,
$filter, $filter,
null null
)->leftJoin("{$baseDataClass}_translationgroups", $joinOnClause); )->leftJoin("{$baseDataClass}_translationgroups", $joinOnClause);
if($stage) Versioned::reading_stage($currentStage);
} else { } else {
$class = $this->owner->class; $translations = DataObject::get($baseDataClass)
$translations = $baseDataClass::get()
->where($filter) ->where($filter)
->leftJoin("{$baseDataClass}_translationgroups", $joinOnClause); ->leftJoin("{$baseDataClass}_translationgroups", $joinOnClause);
} }
@ -1476,6 +1473,11 @@ class Translatable extends DataExtension implements PermissionProvider {
$urlSegment = $newTranslation->URLSegment; $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 // Only make segment unique if it should be enforced
if(Config::inst()->get('Translatable', 'enforce_global_unique_urls')) { if(Config::inst()->get('Translatable', 'enforce_global_unique_urls')) {
$newTranslation->URLSegment = $urlSegment . '-' . i18n::convert_rfc1766($locale); $newTranslation->URLSegment = $urlSegment . '-' . i18n::convert_rfc1766($locale);
@ -1572,15 +1574,15 @@ class Translatable extends DataExtension implements PermissionProvider {
function MetaTags(&$tags) { function MetaTags(&$tags) {
$template = '<link rel="alternate" type="text/html" title="%s" hreflang="%s" href="%s" />' . "\n"; $template = '<link rel="alternate" type="text/html" title="%s" hreflang="%s" href="%s" />' . "\n";
$translations = $this->owner->getTranslations(); $translations = $this->owner->getTranslations();
if($translations) { if($translations->count()) {
$translations = $translations->toArray(); $translations = $translations->toArray();
$translations[] = $this->owner; $translations[] = $this->owner;
foreach($translations as $translation) { foreach($translations as $translation) {
$tags .= sprintf($template, $tags .= sprintf($template,
Convert::raw2xml($translation->Title), Convert::raw2xml($translation->Title),
i18n::convert_rfc1766($translation->Locale), i18n::convert_rfc1766($translation->Locale),
$translation->AbsoluteLink() $translation->AbsoluteLink()
); );
} }
} }
@ -1766,7 +1768,7 @@ class Translatable extends DataExtension implements PermissionProvider {
* @deprecated 2.4 Use get_reading_locale() * @deprecated 2.4 Use get_reading_locale()
*/ */
static function get_reading_lang() { static function get_reading_lang() {
return i18n::get_lang_from_locale(self::get_reading_locale()); return i18n::get_lang_from_locale(self::get_current_locale());
} }
/** /**

View File

@ -24,10 +24,8 @@
"silverstripe/cms": "~3.2" "silverstripe/cms": "~3.2"
}, },
"require-dev": { "require-dev": {
"silverstripe/postgresql": "*", "phpunit/phpunit": "^5.7",
"silverstripe/sqlite3": "*", "squizlabs/php_codesniffer": "^3.0"
"silverstripe/mssql": "*",
"phpunit/PHPUnit": "~3.7@stable"
}, },
"extra": { "extra": {
"screenshots": [ "screenshots": [

View File

@ -16,7 +16,7 @@ ar:
TRANSLATEALLPERMISSION: 'ترجم إلى جميع اللغات المتاحة' TRANSLATEALLPERMISSION: 'ترجم إلى جميع اللغات المتاحة'
TRANSLATEPERMISSION: 'ترجم %s' TRANSLATEPERMISSION: 'ترجم %s'
TRANSLATEVIEWLANGS: 'أعرض قائمة اللغات' TRANSLATEVIEWLANGS: 'أعرض قائمة اللغات'
TRANSLATIONS: تراجم TRANSLATIONS: 'تراجم'
Translatable_Transform: Translatable_Transform:
OriginalCheckboxLabel: 'الأصلية: {قيمة}' OriginalCheckboxLabel: 'الأصلية: {قيمة}'
OriginalFieldLabel: 'الأصلي {عنوان}' OriginalFieldLabel: 'الأصلي {عنوان}'

View File

@ -18,7 +18,7 @@ bs:
TRANSLATEVIEWLANGS: 'Padajući meni jezika' TRANSLATEVIEWLANGS: 'Padajući meni jezika'
TRANSLATIONS: Prevodi TRANSLATIONS: Prevodi
Translatable_Transform: Translatable_Transform:
CheckboxValueNo: 'Ne' CheckboxValueNo: Ne
CheckboxValueYes: 'Da' CheckboxValueYes: Da
OriginalCheckboxLabel: 'Original: {value}' OriginalCheckboxLabel: 'Original: {value}'
OriginalFieldLabel: 'Original: {title}' OriginalFieldLabel: 'Original: {title}'

View File

@ -18,7 +18,7 @@ cs:
TRANSLATEVIEWLANGS: 'Zobrazit seznam jazyků' TRANSLATEVIEWLANGS: 'Zobrazit seznam jazyků'
TRANSLATIONS: Překlady TRANSLATIONS: Překlady
Translatable_Transform: Translatable_Transform:
CheckboxValueNo: 'Ne' CheckboxValueNo: Ne
CheckboxValueYes: 'Ano' CheckboxValueYes: Ano
OriginalCheckboxLabel: 'Původní: {value}' OriginalCheckboxLabel: 'Původní: {value}'
OriginalFieldLabel: 'Původní {title}' OriginalFieldLabel: 'Původní {title}'

View File

@ -18,7 +18,7 @@ cs_CZ:
TRANSLATEVIEWLANGS: 'Zobrazit jazykový rozbalovací seznam' TRANSLATEVIEWLANGS: 'Zobrazit jazykový rozbalovací seznam'
TRANSLATIONS: Překlady TRANSLATIONS: Překlady
Translatable_Transform: Translatable_Transform:
CheckboxValueNo: 'Ne' CheckboxValueNo: Ne
CheckboxValueYes: 'Ano' CheckboxValueYes: Ano
OriginalCheckboxLabel: 'Původní: {value}' OriginalCheckboxLabel: 'Původní: {value}'
OriginalFieldLabel: 'Původní {title}' OriginalFieldLabel: 'Původní {title}'

View File

@ -18,7 +18,7 @@ de:
TRANSLATEVIEWLANGS: 'Kann die verfügbaren Sprachen sehen' TRANSLATEVIEWLANGS: 'Kann die verfügbaren Sprachen sehen'
TRANSLATIONS: Übersetzungen TRANSLATIONS: Übersetzungen
Translatable_Transform: Translatable_Transform:
CheckboxValueNo: 'Nein' CheckboxValueNo: Nein
CheckboxValueYes: 'Ja' CheckboxValueYes: Ja
OriginalCheckboxLabel: 'Original: {value}' OriginalCheckboxLabel: 'Original: {value}'
OriginalFieldLabel: 'Original {title}' OriginalFieldLabel: 'Original {title}'

View File

@ -18,7 +18,7 @@ eo:
TRANSLATEVIEWLANGS: 'Vidigi lingvan falliston' TRANSLATEVIEWLANGS: 'Vidigi lingvan falliston'
TRANSLATIONS: Tradukoj TRANSLATIONS: Tradukoj
Translatable_Transform: Translatable_Transform:
CheckboxValueNo: 'Ne' CheckboxValueNo: Ne
CheckboxValueYes: 'Jes' CheckboxValueYes: Jes
OriginalCheckboxLabel: 'Origina: {value}' OriginalCheckboxLabel: 'Origina: {value}'
OriginalFieldLabel: 'Origina: {title}' OriginalFieldLabel: 'Origina: {title}'

View File

@ -16,5 +16,5 @@ et_EE:
TRANSLATEPERMISSION: 'Tõlgi: %s' TRANSLATEPERMISSION: 'Tõlgi: %s'
TRANSLATIONS: Tõlked TRANSLATIONS: Tõlked
Translatable_Transform: Translatable_Transform:
CheckboxValueNo: 'Ei' CheckboxValueNo: Ei
CheckboxValueYes: 'Jah' CheckboxValueYes: Jah

View File

@ -16,9 +16,9 @@ fa_IR:
TRANSLATEALLPERMISSION: 'ترجمه به تمام زبان های موجود' TRANSLATEALLPERMISSION: 'ترجمه به تمام زبان های موجود'
TRANSLATEPERMISSION: 'ترجمه %s' TRANSLATEPERMISSION: 'ترجمه %s'
TRANSLATEVIEWLANGS: 'نمایش منوی زبان' TRANSLATEVIEWLANGS: 'نمایش منوی زبان'
TRANSLATIONS: ترجمه TRANSLATIONS: 'ترجمه'
Translatable_Transform: Translatable_Transform:
CheckboxValueNo: 'خیر' CheckboxValueNo: خیر
CheckboxValueYes: 'بله' CheckboxValueYes: بله
OriginalCheckboxLabel: 'اصل: {value}' OriginalCheckboxLabel: 'اصل: {value}'
OriginalFieldLabel: 'اصل {title}' OriginalFieldLabel: 'اصل {title}'

View File

@ -18,7 +18,7 @@ fi_FI:
TRANSLATEVIEWLANGS: 'Näytä kielet' TRANSLATEVIEWLANGS: 'Näytä kielet'
TRANSLATIONS: Käännökset TRANSLATIONS: Käännökset
Translatable_Transform: Translatable_Transform:
CheckboxValueNo: 'Ei' CheckboxValueNo: Ei
CheckboxValueYes: 'Kyllä' CheckboxValueYes: Kyllä
OriginalCheckboxLabel: 'Alkuperäinen: {value}' OriginalCheckboxLabel: 'Alkuperäinen: {value}'
OriginalFieldLabel: 'Alkuperäinen {title}' OriginalFieldLabel: 'Alkuperäinen {title}'

24
lang/hr.yml Normal file
View File

@ -0,0 +1,24 @@
hr:
CMSMain:
LANGUAGEDROPDOWNLABEL: Jezik
CMSMain_left:
GO: Kreni
Form:
LANGAOTHER: 'Ostali jezici'
LANGAVAIL: 'Dostupni jezici'
Translatable:
ALLCREATED: 'Svi dozvoljeni prijevodi su kreirani.'
CREATE: 'Kreiraj novi prijevod'
CREATEBUTTON: Kreiraj
EXISTING: 'Postojeći prijevodi'
NEWLANGUAGE: 'Novi jezik'
NOTICENEWPAGE: 'Molimo spremite ovu stranicu prije kreiranja prijevoda'
TRANSLATEALLPERMISSION: 'Prevedi u sve dostupne jezike'
TRANSLATEPERMISSION: 'Prevedi %s'
TRANSLATEVIEWLANGS: 'Pogledaj padajući izbornik jezika'
TRANSLATIONS: Prijevodi
Translatable_Transform:
CheckboxValueNo: Ne
CheckboxValueYes: Da
OriginalCheckboxLabel: 'Original: {value}'
OriginalFieldLabel: 'Original {title}'

View File

@ -19,5 +19,6 @@ it:
TRANSLATIONS: Traduzioni TRANSLATIONS: Traduzioni
Translatable_Transform: Translatable_Transform:
CheckboxValueNo: 'No' CheckboxValueNo: 'No'
CheckboxValueYes: Si
OriginalCheckboxLabel: 'Originale: {value}' OriginalCheckboxLabel: 'Originale: {value}'
OriginalFieldLabel: 'Originale {title}' OriginalFieldLabel: 'Originale {title}'

View File

@ -4,18 +4,18 @@ ja:
CMSMain_left: CMSMain_left:
GO: 実行 GO: 実行
Form: Form:
LANGAOTHER: '他の言語' LANGAOTHER: 他の言語
LANGAVAIL: '利用可能な言語' LANGAVAIL: 利用可能な言語
Translatable: Translatable:
ALLCREATED: '許可された翻訳全てが作成されました。' ALLCREATED: '許可された翻訳全てが作成されました。'
CREATE: '新しい翻訳を行う' CREATE: 新しい翻訳を行う
CREATEBUTTON: 作成 CREATEBUTTON: 作成
EXISTING: '現存中の翻訳' EXISTING: 現存中の翻訳
NEWLANGUAGE: '新しい言語' NEWLANGUAGE: 新しい言語
NOTICENEWPAGE: '翻訳を作成する前にこのページを保存してください' NOTICENEWPAGE: '翻訳を作成する前にこのページを保存してください'
TRANSLATEALLPERMISSION: '全ての利用可能言語に翻訳' TRANSLATEALLPERMISSION: '全ての利用可能言語に翻訳'
TRANSLATEPERMISSION: '%sを翻訳' TRANSLATEPERMISSION: '%sを翻訳'
TRANSLATEVIEWLANGS: '言語ドロップダウンを表示' TRANSLATEVIEWLANGS: 言語ドロップダウンを表示
TRANSLATIONS: 翻訳 TRANSLATIONS: 翻訳
Translatable_Transform: Translatable_Transform:
OriginalCheckboxLabel: 'オリジナル: {value}' OriginalCheckboxLabel: 'オリジナル: {value}'

View File

@ -16,7 +16,7 @@ mi:
TRANSLATEALLPERMISSION: 'Whakamāoritia ki ngā reo katoa e wātea ana' TRANSLATEALLPERMISSION: 'Whakamāoritia ki ngā reo katoa e wātea ana'
TRANSLATEPERMISSION: 'Whakamāoritia a %s' TRANSLATEPERMISSION: 'Whakamāoritia a %s'
TRANSLATEVIEWLANGS: 'Tirohia te takaiho reo' TRANSLATEVIEWLANGS: 'Tirohia te takaiho reo'
TRANSLATIONS: Ngā whakamāoritanga TRANSLATIONS: 'Ngā whakamāoritanga'
Translatable_Transform: Translatable_Transform:
OriginalCheckboxLabel: 'Taketake: {value}' OriginalCheckboxLabel: 'Taketake: {value}'
OriginalFieldLabel: '{title} taketake' OriginalFieldLabel: '{title} taketake'

20
lang/nl_NL.yml Normal file
View File

@ -0,0 +1,20 @@
nl_NL:
CMSMain:
LANGUAGEDROPDOWNLABEL: Taal
CMSMain_left:
GO: Gaan
Form:
LANGAOTHER: 'Andere talen'
LANGAVAIL: 'Beschikbare talen'
Translatable:
ALLCREATED: 'Alle toegestane vertalingen werden gecreëerd.'
CREATE: 'Nieuwe vertaling creëren'
CREATEBUTTON: Creëren
EXISTING: 'Bestaande vertalingen'
NEWLANGUAGE: 'Nieuwe taal'
TRANSLATEALLPERMISSION: 'Vertaal in alle beschikbare talen'
TRANSLATEPERMISSION: 'Vertaal %s'
TRANSLATIONS: Vertalingen
Translatable_Transform:
CheckboxValueNo: Neen
CheckboxValueYes: Ja

24
lang/ru.yml Normal file
View File

@ -0,0 +1,24 @@
ru:
CMSMain:
LANGUAGEDROPDOWNLABEL: Язык
CMSMain_left:
GO: Выполн.
Form:
LANGAOTHER: 'Другие языки'
LANGAVAIL: 'Доступные языки'
Translatable:
ALLCREATED: 'Все переводы на доступные языки созданы.'
CREATE: 'Создать новый перевод'
CREATEBUTTON: Создать
EXISTING: 'Существующие переводы'
NEWLANGUAGE: 'Добавить язык'
NOTICENEWPAGE: 'Пожалуйста, сохраните данную страницу прежде чем создавать перевод'
TRANSLATEALLPERMISSION: 'Перевести на все доступные языки'
TRANSLATEPERMISSION: 'Перевести %s'
TRANSLATEVIEWLANGS: 'Отобразить языковое выпадающее меню'
TRANSLATIONS: Переводы
Translatable_Transform:
CheckboxValueNo: Нет
CheckboxValueYes: Да
OriginalCheckboxLabel: 'Оригинальное значение: {value}'
OriginalFieldLabel: 'Оригинальное {title}'

View File

@ -18,7 +18,7 @@ sk:
TRANSLATEVIEWLANGS: 'Zobraziť zoznam jazykov' TRANSLATEVIEWLANGS: 'Zobraziť zoznam jazykov'
TRANSLATIONS: Preklady TRANSLATIONS: Preklady
Translatable_Transform: Translatable_Transform:
CheckboxValueNo: 'Nie' CheckboxValueNo: Nie
CheckboxValueYes: 'Áno' CheckboxValueYes: Áno
OriginalCheckboxLabel: 'Pôvodné: {value}' OriginalCheckboxLabel: 'Pôvodné: {value}'
OriginalFieldLabel: 'Pôvodné {title}' OriginalFieldLabel: 'Pôvodné {title}'

View File

@ -18,7 +18,7 @@ sk_SK:
TRANSLATEVIEWLANGS: 'Zobraziť jazykový rozbaľovací zoznam' TRANSLATEVIEWLANGS: 'Zobraziť jazykový rozbaľovací zoznam'
TRANSLATIONS: Preklady TRANSLATIONS: Preklady
Translatable_Transform: Translatable_Transform:
CheckboxValueNo: 'Nie' CheckboxValueNo: Nie
CheckboxValueYes: 'Áno' CheckboxValueYes: Áno
OriginalCheckboxLabel: 'Pôvodné: {value}' OriginalCheckboxLabel: 'Pôvodné: {value}'
OriginalFieldLabel: 'Pôvodné {title}' OriginalFieldLabel: 'Pôvodné {title}'

View File

@ -18,5 +18,7 @@ sv:
TRANSLATEVIEWLANGS: 'Visa språk listan' TRANSLATEVIEWLANGS: 'Visa språk listan'
TRANSLATIONS: Översättningar TRANSLATIONS: Översättningar
Translatable_Transform: Translatable_Transform:
CheckboxValueNo: Nej
CheckboxValueYes: Ja
OriginalCheckboxLabel: 'Original: {value}' OriginalCheckboxLabel: 'Original: {value}'
OriginalFieldLabel: 'Original {title}' OriginalFieldLabel: 'Original {title}'

View File

@ -18,7 +18,7 @@ tr:
TRANSLATEVIEWLANGS: 'Mevcut dilleri görebilir' TRANSLATEVIEWLANGS: 'Mevcut dilleri görebilir'
TRANSLATIONS: Çeviriler TRANSLATIONS: Çeviriler
Translatable_Transform: Translatable_Transform:
CheckboxValueNo: 'Hayır' CheckboxValueNo: Hayır
CheckboxValueYes: 'Evet' CheckboxValueYes: Evet
OriginalCheckboxLabel: 'Orijinal: {value}' OriginalCheckboxLabel: 'Orijinal: {value}'
OriginalFieldLabel: 'Orijinal {title}' OriginalFieldLabel: 'Orijinal {title}'

View File

@ -1,6 +1,6 @@
vi_VN: vi_VN:
CMSMain: CMSMain:
LANGUAGEDROPDOWNLABEL: Ngôn ngữ LANGUAGEDROPDOWNLABEL: 'Ngôn ngữ'
CMSMain_left: CMSMain_left:
GO: Đi GO: Đi
Form: Form:
@ -16,7 +16,7 @@ vi_VN:
TRANSLATEALLPERMISSION: 'Dịch sang mọi ngôn gữ có th' TRANSLATEALLPERMISSION: 'Dịch sang mọi ngôn gữ có th'
TRANSLATEPERMISSION: 'Dịch %s' TRANSLATEPERMISSION: 'Dịch %s'
TRANSLATEVIEWLANGS: 'Xem danh sách ngôn ng' TRANSLATEVIEWLANGS: 'Xem danh sách ngôn ng'
TRANSLATIONS: Dịch thuật TRANSLATIONS: 'Dịch thuật'
Translatable_Transform: Translatable_Transform:
OriginalCheckboxLabel: 'Mặc định :{value}' OriginalCheckboxLabel: 'Mặc định :{value}'
OriginalFieldLabel: 'Mặc định:{title}' OriginalFieldLabel: 'Mặc định:{title}'

View File

@ -5,17 +5,17 @@ zh:
GO: 前往 GO: 前往
Form: Form:
LANGAOTHER: '其它语言' LANGAOTHER: '其它语言'
LANGAVAIL: '可用的语言' LANGAVAIL: 可用的语言
Translatable: Translatable:
ALLCREATED: '所有允许的翻译均已创建。' ALLCREATED: '所有允许的翻译均已创建。'
CREATE: '创建新的翻译' CREATE: 创建新的翻译
CREATEBUTTON: 创建 CREATEBUTTON: 创建
EXISTING: '现存的翻译' EXISTING: 现存的翻译
NEWLANGUAGE: '新语言' NEWLANGUAGE: 新语言
NOTICENEWPAGE: '创建翻译前,请先保存本页面。' NOTICENEWPAGE: '创建翻译前,请先保存本页面。'
TRANSLATEALLPERMISSION: '翻译成所有可用语言' TRANSLATEALLPERMISSION: 翻译成所有可用语言
TRANSLATEPERMISSION: '翻译 %s' TRANSLATEPERMISSION: '翻译 %s'
TRANSLATEVIEWLANGS: '查看语言下拉菜单' TRANSLATEVIEWLANGS: 查看语言下拉菜单
TRANSLATIONS: 翻译 TRANSLATIONS: 翻译
Translatable_Transform: Translatable_Transform:
OriginalCheckboxLabel: '原文:{value}' OriginalCheckboxLabel: '原文:{value}'

View File

@ -22,6 +22,9 @@ class TranslatableSiteConfigTest extends SapphireTest {
$this->origLocale = Translatable::default_locale(); $this->origLocale = Translatable::default_locale();
Translatable::set_default_locale("en_US"); Translatable::set_default_locale("en_US");
// Delete any default records created outside of fixtures
SiteConfig::get()->exclude('ID', $this->allFixtureIDs('SiteConfig'))->removeAll();
} }
function tearDown() { function tearDown() {

View File

@ -459,7 +459,32 @@ class TranslatableTest extends FunctionalTest {
Config::inst()->update('Translatable', 'enforce_global_unique_urls', true); Config::inst()->update('Translatable', 'enforce_global_unique_urls', true);
Translatable::set_current_locale('en_US'); 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() { function testUpdateCMSFieldsOnSiteTree() {
$pageOrigLang = new TranslatableTest_Page(); $pageOrigLang = new TranslatableTest_Page();
$pageOrigLang->write(); $pageOrigLang->write();