Added proper internationalization

This commit is contained in:
Franck Allimant
2014-06-18 20:24:56 +02:00
parent 0d0f04bf29
commit 7b3002067d
3 changed files with 29 additions and 16 deletions

View File

@@ -3,4 +3,12 @@
<config xmlns="http://thelia.net/schema/dic/config" <config xmlns="http://thelia.net/schema/dic/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd"> xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<services>
<service id="smarty.plugin.tinymce_lang" class="Tinymce\Smarty\TinyMCELanguage" scope="request">
<tag name="thelia.parser.register_plugin"/>
<argument type="service" id="request"/>
</service>
</services>
</config> </config>

View File

@@ -14,7 +14,6 @@ namespace Tinymce;
use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Connection\ConnectionInterface;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Filesystem;
use Thelia\Install\Database;
use Thelia\Module\BaseModule; use Thelia\Module\BaseModule;
class Tinymce extends BaseModule class Tinymce extends BaseModule
@@ -27,7 +26,6 @@ class Tinymce extends BaseModule
public function __construct() public function __construct()
{ {
$this->jsPath = __DIR__ . DS .'Resources' . DS . 'js' . DS . 'tinymce'; $this->jsPath = __DIR__ . DS .'Resources' . DS . 'js' . DS . 'tinymce';
$this->mediaPath = __DIR__ . DS .'Resources' . DS . 'media';
$this->webJsPath = THELIA_WEB_DIR . 'tinymce'; $this->webJsPath = THELIA_WEB_DIR . 'tinymce';
$this->webMediaPath = THELIA_WEB_DIR . 'media'; $this->webMediaPath = THELIA_WEB_DIR . 'media';
@@ -37,15 +35,14 @@ class Tinymce extends BaseModule
*/ */
public function postActivation(ConnectionInterface $con = null) public function postActivation(ConnectionInterface $con = null)
{ {
// Create symbolic links in the web directory, to make the TinyMCE code
// and the content of the 'media' directory available.
$fs = new Filesystem(); $fs = new Filesystem();
// Create symbolic links in the web directory, to make the TinyMCE code available.
if (false === $fs->exists($this->webJsPath)) { if (false === $fs->exists($this->webJsPath)) {
$fs->symlink($this->jsPath, $this->webJsPath); $fs->symlink($this->jsPath, $this->webJsPath);
} }
// Create the media directory in the web root // Create the media directory in the web root, if required
if (false === $fs->exists($this->webMediaPath)) { if (false === $fs->exists($this->webMediaPath)) {
$fs->mkdir($this->webMediaPath."/upload"); $fs->mkdir($this->webMediaPath."/upload");
@@ -61,7 +58,6 @@ class Tinymce extends BaseModule
$fs = new Filesystem(); $fs = new Filesystem();
$fs->remove($this->webJsPath); $fs->remove($this->webJsPath);
$fs->remove($this->mediaPath);
} }
/** /**
@@ -69,6 +65,7 @@ class Tinymce extends BaseModule
*/ */
public function destroy(ConnectionInterface $con = null, $deleteModuleData = false) public function destroy(ConnectionInterface $con = null, $deleteModuleData = false)
{ {
// If we have to delete module data, remove the media directory.
if ($deleteModuleData) { if ($deleteModuleData) {
$fs = new Filesystem(); $fs = new Filesystem();

View File

@@ -11,24 +11,29 @@
// Set it to true to display the menubar. // Set it to true to display the menubar.
menubar : false, menubar : false,
// Available language are in Resources/js/tinymce/langs // Use our smarty plugin to guess the best available language
//language: "{lang attr='locale'}", language: "{tinymce_lang}",
// Available language are in Resources/js/tinymce/plugins // See available plugins at http://www.tinymce.com/wiki.php/Plugins
plugins: [ plugins: [
"advlist autolink link image lists charmap print preview hr anchor pagebreak", "advlist autolink link image lists charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars insertdatetime media nonbreaking", "searchreplace wordcount visualblocks visualchars insertdatetime media nonbreaking",
"table contextmenu directionality emoticons paste textcolor responsivefilemanager", "table contextmenu directionality emoticons paste textcolor responsivefilemanager",
"youtube" "fullscreen code youtube"
], ],
toolbar1: "undo redo | bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | styleselect | filemanager | link unlink anchor | image media | youtube | forecolor backcolor | print preview code ", // See available controls at http://www.tinymce.com/wiki.php/Controls
toolbar1: "undo redo | bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | hr | styleselect | filemanager | code | fullscreen",
toolbar2: "link unlink anchor | image responsivefilemanager media youtube | forecolor backcolor | charmap | print preview ",
image_advtab: true, image_advtab: true,
// File manager configuration
external_filemanager_path: "{url file='/tinymce/filemanager/'}", external_filemanager_path: "{url file='/tinymce/filemanager/'}",
filemanager_title:"{intl l='Files manager'}" , filemanager_title: "{intl l='File manager'}" ,
external_plugins: { "filemanager" : "{url file='/tinymce/filemanager/plugin.min.js'}"}, external_plugins: { "filemanager" : "{url file='/tinymce/filemanager/plugin.min.js'}"},
// Always paste as text, removing external formatting // Always paste as text, removing external formatting when pasting text
//paste_as_text: true, //paste_as_text: true,
// All newlines are <p>, Shift+enter inserts <br /> // All newlines are <p>, Shift+enter inserts <br />
@@ -37,6 +42,9 @@
relative_urls : false, relative_urls : false,
document_base_url : "{url path="/media"}", document_base_url : "{url path="/media"}",
content_css: "{stylesheets file='assets/css/editor.less' filters='less' source='Tinymce'}{$asset_url}{/stylesheets}" // Styles (CSS or LESS) available in the editor could be defined in assets/css/editor.less file.
{stylesheets file='assets/css/editor.less' filters='less' source='Tinymce'}
content_css: "{$asset_url}"
{/stylesheets}
}); });
</script> </script>