Skip to content

Commit 58dee1a

Browse files
committed
Init
0 parents  commit 58dee1a

22 files changed

+5478
-0
lines changed

LICENSE

+339
Large diffs are not rendered by default.

_admin.php

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?php
2+
# -- BEGIN LICENSE BLOCK ----------------------------------
3+
#
4+
# This file is part of translater, a plugin for Dotclear 2.
5+
#
6+
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
7+
# contact@jcdenis.fr
8+
#
9+
# Licensed under the GPL version 2.0 license.
10+
# A copy of this license is available in LICENSE file or at
11+
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
12+
#
13+
# -- END LICENSE BLOCK ------------------------------------
14+
15+
if (!defined('DC_CONTEXT_ADMIN')){return;}
16+
17+
$core->blog->settings->addNamespace('translater');
18+
$core->addBehavior('pluginsToolsTabs',array('translaterAdminBehaviors','pluginsToolsTabs'));
19+
$core->addBehavior('adminCurrentThemeDetails',array('translaterAdminBehaviors','adminCurrentThemeDetails'));
20+
$core->addBehavior('addTranslaterProposalTool',array('translaterAdminBehaviors','addGoogleProposalTool'));
21+
$core->addBehavior('addTranslaterProposalTool',array('translaterAdminBehaviors','addYahooProposalTool'));
22+
$core->addBehavior('addTranslaterProposalTool',array('translaterAdminBehaviors','addMicrosoftProposalTool'));
23+
$core->rest->addFunction('getProposal',array('translaterRest','getProposal'));
24+
25+
$_menu['Plugins']->addItem(
26+
__('Translater'),
27+
'plugin.php?p=translater',
28+
'index.php?pf=translater/icon.png',
29+
preg_match('/plugin.php\?p=translater(&.*)?$/',$_SERVER['REQUEST_URI']),
30+
$core->auth->isSuperAdmin()
31+
);
32+
33+
class translaterAdminBehaviors
34+
{
35+
# Plugins tab
36+
public static function pluginsToolsTabs($core)
37+
{
38+
if (!$core->blog->settings->translater->translater_plugin_menu || !$core->auth->isSuperAdmin()) {
39+
return;
40+
}
41+
42+
echo
43+
'<div class="multi-part" id="translater" title="'.
44+
__('Translate extensions').
45+
'">'.
46+
'<table class="clear"><tr>'.
47+
'<th>&nbsp;</th>'.
48+
'<th>'.__('Name').'</th>'.
49+
'<th class="nowrap">'.__('Version').'</th>'.
50+
'<th class="nowrap">'.__('Details').'</th>'.
51+
'<th class="nowrap">'.__('Author').'</th>'.
52+
'</tr>';
53+
54+
$modules = $core->plugins->getModules();
55+
56+
foreach ($modules as $name => $plugin)
57+
{
58+
echo
59+
'<tr class="line">'.
60+
'<td class="nowrap">'.
61+
'<a href="plugin.php?p=translater&amp;part=module&amp;type=plugin&amp;module='.$name.'"'.
62+
' title="'.__('Translate this plugin').'">'.__($plugin['name']).'</a></td>'.
63+
'<td class="nowrap">'.$name.'</td>'.
64+
'<td class="nowrap">'.$plugin['version'].'</td>'.
65+
'<td class="maximal">'.$plugin['desc'].'</td>'.
66+
'<td class="nowrap">'.$plugin['author'].'</td>'.
67+
'</tr>';
68+
}
69+
echo '</table></div>';
70+
}
71+
72+
# Themes menu
73+
public static function adminCurrentThemeDetails($core,$id,$infos)
74+
{
75+
if (!$core->blog->settings->translater->translater_theme_menu || !$core->auth->isSuperAdmin()) {
76+
return;
77+
}
78+
79+
$root = path::real($infos['root']);
80+
81+
if ($id != 'default' && is_dir($root.'/locales'))
82+
{
83+
return
84+
'<p><a href="plugin.php?p=translater&amp;part=module&amp;type=theme&amp;module='.$id.'"'.
85+
' class="button">'.__('Translate this theme').'</a></p>';
86+
}
87+
}
88+
89+
# Google Translater tools
90+
public static function addGoogleProposalTool($proposal)
91+
{
92+
$proposal->addTool('googleProposalTool');
93+
}
94+
95+
# Yahoo Babelfish tools
96+
public static function addYahooProposalTool($proposal)
97+
{
98+
$proposal->addTool('yahooProposalTool');
99+
}
100+
101+
# Microsoft Bing tools
102+
public static function addMicrosoftProposalTool($proposal)
103+
{
104+
$proposal->addTool('microsoftProposalTool');
105+
}
106+
}
107+
?>

_define.php

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
# -- BEGIN LICENSE BLOCK ----------------------------------
3+
#
4+
# This file is part of translater, a plugin for Dotclear 2.
5+
#
6+
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
7+
# contact@jcdenis.fr
8+
#
9+
# Licensed under the GPL version 2.0 license.
10+
# A copy of this license is available in LICENSE file or at
11+
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
12+
#
13+
# -- END LICENSE BLOCK ------------------------------------
14+
15+
if (!defined('DC_RC_PATH')){return;}
16+
17+
$this->registerModule(
18+
/* Name */ "translater",
19+
/* Description*/ "Translate your Dotclear plugins and themes",
20+
/* Author */ "JC Denis",
21+
/* Version */ '2013.05.11',
22+
/* Permissions */ null
23+
);
24+
?>

_install.php

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
# -- BEGIN LICENSE BLOCK ----------------------------------
3+
#
4+
# This file is part of translater, a plugin for Dotclear 2.
5+
#
6+
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
7+
# contact@jcdenis.fr
8+
#
9+
# Licensed under the GPL version 2.0 license.
10+
# A copy of this license is available in LICENSE file or at
11+
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
12+
#
13+
# -- END LICENSE BLOCK ------------------------------------
14+
15+
if (!defined('DC_CONTEXT_ADMIN')){return;}
16+
17+
$rdc_version = '2.5-alpha';
18+
$new_version = $core->plugins->moduleInfo('translater','version');
19+
$old_version = $core->getVersion('translater');
20+
21+
if (version_compare($old_version,$new_version,'>=')) return;
22+
23+
try
24+
{
25+
if (version_compare(str_replace("-r","-p",DC_VERSION),$rdc_version,'<')) {
26+
throw new Exception(sprintf('%s requires Dotclear %s','translater',$rdc_version));
27+
}
28+
29+
$core->blog->settings->addNamespace('translater');
30+
31+
$core->blog->settings->translater->put('translater_plugin_menu',0,'boolean','Put a link in plugins page',false,true);
32+
$core->blog->settings->translater->put('translater_theme_menu',0,'boolean','Put a link in themes page',false,true);
33+
$core->blog->settings->translater->put('translater_backup_auto',1,'boolean','Make a backup of languages old files when there are modified',false,true);
34+
$core->blog->settings->translater->put('translater_backup_limit',20,'string','Maximum backups per module',false,true);
35+
$core->blog->settings->translater->put('translater_backup_folder','module','string','In which folder to store backups',false,true);
36+
$core->blog->settings->translater->put('translater_start_page','setting,','string','Page to start on',false,true);
37+
$core->blog->settings->translater->put('translater_write_po',1,'boolean','Write .po languages files',false,true);
38+
$core->blog->settings->translater->put('translater_write_langphp',1,'boolean','Write .lang.php languages files',false,true);
39+
$core->blog->settings->translater->put('translater_scan_tpl',0,'boolean','Translate strings of templates files',false,true);
40+
$core->blog->settings->translater->put('translater_parse_nodc',1,'boolean','Translate only untranslated strings of Dotclear',false,true);
41+
$core->blog->settings->translater->put('translater_hide_default',1,'boolean','Hide default modules of Dotclear',false,true);
42+
$core->blog->settings->translater->put('translater_parse_comment',1,'boolean','Write comments and strings informations in lang files',false,true);
43+
$core->blog->settings->translater->put('translater_parse_user',1,'boolean','Write inforamtions about author in lang files',false,true);
44+
$core->blog->settings->translater->put('translater_parse_userinfo','displayname, email','string','Type of informations about user to write',false,true);
45+
$core->blog->settings->translater->put('translater_import_overwrite',0,'boolean','Overwrite existing languages when import packages',false,true);
46+
$core->blog->settings->translater->put('translater_export_filename','type-module-l10n-timestamp','string','Name of files of exported package',false,true);
47+
$core->blog->settings->translater->put('translater_proposal_tool','google','string','Id of default tool for proposed translation',false,true);
48+
$core->blog->settings->translater->put('translater_proposal_lang','en','string','Default source language for proposed translation',false,true);
49+
50+
$core->setVersion('translater',$new_version);
51+
52+
return true;
53+
}
54+
catch (Exception $e)
55+
{
56+
$core->error->add($e->getMessage());
57+
}
58+
return false;
59+
?>

_prepend.php

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
# -- BEGIN LICENSE BLOCK ----------------------------------
3+
#
4+
# This file is part of translater, a plugin for Dotclear 2.
5+
#
6+
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
7+
# contact@jcdenis.fr
8+
#
9+
# Licensed under the GPL version 2.0 license.
10+
# A copy of this license is available in LICENSE file or at
11+
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
12+
#
13+
# -- END LICENSE BLOCK ------------------------------------
14+
15+
if (!defined('DC_RC_PATH')){return;}
16+
17+
global $__autoload;
18+
19+
$__autoload['dcTranslater'] = dirname(__FILE__).'/inc/class.dc.translater.php';
20+
$__autoload['translaterRest'] = dirname(__FILE__).'/inc/class.translater.rest.php';
21+
$__autoload['translaterProposals'] = dirname(__FILE__).'/inc/class.translater.proposals.php';
22+
23+
$__autoload['translaterProposalTool'] = dirname(__FILE__).'/inc/lib.translater.proposal.php';
24+
$__autoload['googleProposalTool'] = dirname(__FILE__).'/inc/lib.translater.google.php';
25+
$__autoload['microsoftProposalTool'] = dirname(__FILE__).'/inc/lib.translater.microsoft.php';
26+
?>

_uninstall.php

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
# -- BEGIN LICENSE BLOCK ----------------------------------
3+
#
4+
# This file is part of translater, a plugin for Dotclear 2.
5+
#
6+
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
7+
# contact@jcdenis.fr
8+
#
9+
# Licensed under the GPL version 2.0 license.
10+
# A copy of this license is available in LICENSE file or at
11+
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
12+
#
13+
# -- END LICENSE BLOCK ------------------------------------
14+
15+
if (!defined('DC_CONTEXT_ADMIN')){return;}
16+
17+
$this->addUserAction(
18+
/* type */ 'settings',
19+
/* action */ 'delete_all',
20+
/* ns */ 'translater',
21+
/* description */ __('delete all settings')
22+
);
23+
24+
$this->addUserAction(
25+
/* type */ 'plugins',
26+
/* action */ 'delete',
27+
/* ns */ 'translater',
28+
/* description */ __('delete plugin files')
29+
);
30+
31+
$this->addUserAction(
32+
/* type */ 'versions',
33+
/* action */ 'delete',
34+
/* ns */ 'translater',
35+
/* description */ __('delete the version number')
36+
);
37+
38+
39+
$this->addDirectAction(
40+
/* type */ 'settings',
41+
/* action */ 'delete_all',
42+
/* ns */ 'translater',
43+
/* description */ sprintf(__('delete all %s settings'),'translater')
44+
);
45+
46+
$this->addDirectAction(
47+
/* type */ 'plugins',
48+
/* action */ 'delete',
49+
/* ns */ 'translater',
50+
/* description */ sprintf(__('delete %s plugin files'),'translater')
51+
);
52+
53+
$this->addDirectAction(
54+
/* type */ 'versions',
55+
/* action */ 'delete',
56+
/* ns */ 'translater',
57+
/* description */ sprintf(__('delete %s version number'),'translater')
58+
);
59+
?>

icon.png

691 Bytes
Loading

0 commit comments

Comments
 (0)