Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajkapsz committed Sep 22, 2013
0 parents commit 1c1187f
Show file tree
Hide file tree
Showing 6 changed files with 2,169 additions and 0 deletions.
26 changes: 26 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
All source code included in the "Language: Slovak" extension
is, unless otherwise specified, released under the MIT licence as follows:

----- begin license block -----

Copyright 2013 Juraj Kapsz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

----- end license block -----
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Language: Slovak

Slovenský preklad [Symphony](http://getsymphony.com).
Slovak translation of [Symphony](http://getsymphony.com).

## Inštalácia / Installation

1. Súbory nahrajte v priečinku `lang_slovak` do systémového Symphony priečinka `extensions`. / Upload the `lang_slovak` folder into Symphony's `extensions` folder.
2. Prejdite do "System" > "Extensions", vyberte "Language: Slovak" a z menu "With Selected..." dole zvoľte "Enable / Install" a potvrďte "Apply". / Go to "System" > "Extensions", select the "Language: Slovak" Extension, choose "Enable" from the "With Selected..." menu at the bottom, then click "Apply".
3. Teraz môžeme nastaviť v "System" > "Preferences" hodnotu "System Language" na "Slovensky" a zmenu použiť globálne. / You can now change the "System Language" option at "System" > "Preferences" to apply the translation globally.

## Aktualizácia / Updating

1. Zopakujte kroky 1 a 2, uvedené vyššie. / Repeat the Step 1 and 2 above.
98 changes: 98 additions & 0 deletions extension.driver.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?php

/**
* @see http://www.getsymphony.com/learn/api/2.3.3/toolkit/extension/
*
* based on https://github.com/hananils/lang_german
*/

Class extension_lang_slovak extends Extension {

public function getSubscribedDelegates(){
return array(
array(
'page' => '/system/preferences/',
'delegate' => 'Save',
'callback' => '__toggleSlovak'
)
);
}

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

// Set Slovak date and time settings
if($context['settings']['symphony']['lang'] == 'sk') {
$this->__setSlovak();
}

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

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-slovak-storage');
Symphony::Configuration()->set('time_format', $time, 'lang-slovak-storage');
Symphony::Configuration()->set('datetime_separator', $separator, 'lang-slovak-storage');
Administration::instance()->saveConfig();
}

public function enable(){
if(Symphony::Configuration()->get('lang', 'symphony') == 'sk') {
$this->__setSlovak();
}
}

public function disable(){
$this->__unsetSlovak();
}

public function uninstall() {
$this->__unsetSlovak();

// Remove storage
Symphony::Configuration()->remove('lang-slovak-storage');
Administration::instance()->saveConfig();
}

/**
* Set Slovak date and time format
*/
private function __setSlovak() {

// Set Slovak date and time settings
Symphony::Configuration()->set('date_format', 'j.n.Y', 'region');
Symphony::Configuration()->set('time_format', 'G:i', 'region');
Symphony::Configuration()->set('datetime_separator', ', ', 'region');
Administration::instance()->saveConfig();
}

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

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

// Store new date and time settings
Symphony::Configuration()->set('date_format', $date, 'region');
Symphony::Configuration()->set('time_format', $time, 'region');
Symphony::Configuration()->set('datetime_separator', $separator, 'region');
Administration::instance()->saveConfig();
}

}
21 changes: 21 additions & 0 deletions extension.meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension id="lang_slovak" status="released" xmlns="http://symphony-cms.com/schemas/extension/1.0">
<name>Language: Slovak</name>
<description>Slovak translation for Symphony</description>
<repo type="github">https://github.com/jurajkapsz/lang_slovak</repo>
<types>
<type>Translations</type>
</types>
<authors>
<author>
<name github="jurajkapsz" symphony="juro">Juraj Kapsz</name>
<website>http://jurajkapsz.sk</website>
</author>
</authors>
<releases>
<release version="1.0" date="2013-09-22" min="2.3">
* Initial release
* Compatible with Symphony 2.3 and up
</release>
</releases>
</extension>
11 changes: 11 additions & 0 deletions extension.package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<package name="lang_slovak" type="extension" version="1.0">
<files>
<file location="/">extension.driver.php</file>
<file location="/">extension.meta.xml</file>
<file location="/">extension.package.xml</file>
<file location="/">README.md</file>
<file location="/">LICENSE</file>
<file location="/lang">lang.sk.php</file>
</files>
</package>
Loading

0 comments on commit 1c1187f

Please sign in to comment.