Permalink
Browse files

Only suffix unique URLSegment if enforce_global_unique_urls=true (#138)

  • Loading branch information...
1 parent 69adec9 commit 15e9037c1b140ec81bebb3ac74bd9a7700ee6b2f @chillu chillu committed Sep 5, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 code/model/Translatable.php
@@ -1439,7 +1439,12 @@ function createTranslation($locale, $saveTranslation = true) {
} else {
$urlSegment = $newTranslation->URLSegment;
}
- $newTranslation->URLSegment = $urlSegment . '-' . i18n::convert_rfc1766($locale);
+
+ // 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);
+ }
+
// hacky way to set an existing translation group in onAfterWrite()
$translationGroupID = $this->getTranslationGroup();
$newTranslation->_TranslationGroupID = $translationGroupID ? $translationGroupID : $this->owner->ID;

0 comments on commit 15e9037

Please sign in to comment.