Skip to content

Commit

Permalink
Add Transliteration
Browse files Browse the repository at this point in the history
Transliteration for non-breaking space, slight version bump
  • Loading branch information
animaux committed Oct 29, 2015
1 parent e82bc46 commit dbe2a14
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
37 changes: 19 additions & 18 deletions extension.driver.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

Class extension_lang_german extends Extension {

/**
* @see http://symphony-cms.com/learn/api/2.3/toolkit/extension/#getSubscribedDelegates
*/
Expand All @@ -14,33 +14,33 @@ public function getSubscribedDelegates(){
)
);
}

/**
* Toggle between German and default date and time settings
*/
public function __toggleGerman($context) {

// Set German date and time settings
if($context['settings']['symphony']['lang'] == 'de') {
$this->__setGerman();
}

// Restore default date and time settings
else {
$this->__unsetGerman();
}
}

/**
* @see http://symphony-cms.com/learn/api/2.3/toolkit/extension/#install
*/
public function install() {

// Fetch current date and time settings
$date = Symphony::Configuration()->get('date_format', 'region');
$time = Symphony::Configuration()->get('time_format', 'region');
$separator = Symphony::Configuration()->get('datetime_separator', 'region');

// Store current date and time settings
Symphony::Configuration()->set('date_format', $date, 'lang-german-storage');
Symphony::Configuration()->set('time_format', $time, 'lang-german-storage');
Expand Down Expand Up @@ -74,34 +74,35 @@ public function uninstall() {
Symphony::Configuration()->remove('lang-german-storage');
Symphony::Configuration()->write();
}

/**
* Set German date and time format
*/
private function __setGerman() {

// Set German date and time settings
Symphony::Configuration()->set('date_format', 'j. F Y', 'region');
Symphony::Configuration()->set('date_format', 'd. F Y', 'region');
Symphony::Configuration()->set('time_format', 'H:i', 'region');
Symphony::Configuration()->set('datetime_separator', ', ', 'region');
Symphony::Configuration()->set('datetime_separator', ', ', 'region');
Symphony::Configuration()->write();
}

/**
* Reset default date and time format
*/
private function __unsetGerman() {

// Fetch current date and time settings
$date = Symphony::Configuration()->get('date_format', 'lang-german-storage');
$time = Symphony::Configuration()->get('time_format', 'lang-german-storage');
$separator = Symphony::Configuration()->get('datetime_separator', 'lang-german-storage');

$separator = Symphony::Configuration()->get('datetime_separator', 'lang-german-storage');
// Store new date and time settings
Symphony::Configuration()->set('date_format', ($date ? $date : 'g:i a'), 'region');
Symphony::Configuration()->set('time_format', ($time ? $time : 'm/d/Y'), 'region');
Symphony::Configuration()->set('datetime_separator', ($separator ? $separator : ' '), 'region');
Symphony::Configuration()->set('date_format', $date, 'region');
Symphony::Configuration()->set('time_format', $time, 'region');
Symphony::Configuration()->set('datetime_separator', $separator, 'region');
Symphony::Configuration()->write();
}

}

5 changes: 4 additions & 1 deletion extension.meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<extension id="lang_german" status="beta" xmlns="http://symphony-cms.com/schemas/extension/1.0">
<name>Language: German</name>
<description>German translation for Symphony</description>
<repo type="github">https://github.com/hananils/lang_german</repo>
<repo type="github">https://github.com/animaux/lang_german</repo>
<url type="discuss">http://symphony-cms.com/discuss/thread/632/</url>
<types>
<type>Translations</type>
Expand All @@ -18,6 +18,9 @@
</author>
</authors>
<releases>
<release version="2.2.1" date="2015-10-29" min="2.6.0">
- Transliteration for non-breaking space
</release>
<release version="2.2.0" date="2015-07-21" min="2.6.0">
- Symphony 2.6 compatibility
</release>
Expand Down
1 change: 1 addition & 0 deletions lang/lang.de.php
Original file line number Diff line number Diff line change
Expand Up @@ -2124,6 +2124,7 @@

// Other characters

' ' => null,

);

Expand Down

0 comments on commit dbe2a14

Please sign in to comment.