Skip to content

Commit

Permalink
Finish localisation
Browse files Browse the repository at this point in the history
  • Loading branch information
svivian committed Jul 30, 2015
1 parent a5ed41d commit 409ff43
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
21 changes: 12 additions & 9 deletions qa-tagging-tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ public function filter_question(&$question, &$errors, $oldquestion)
}

if (count($errorTags)) {
$msg = 'You need '.$reqPoints.' points to create new tags. The following tags are not allowed: '.qa_html(implode(', ', $errorTags));
$msg = strtr(qa_lang_html('taggingtools/tags_not_usable'), array(
'^1' => qa_html($reqPoints),
'^2' => qa_html(implode(', ', $errorTags)),
));
$errors['tags'] = $msg;
}
}
Expand Down Expand Up @@ -90,11 +93,11 @@ public function admin_form(&$qa_content)
qa_opt('tagging_tools_synonyms', strtolower(trim(qa_post_text('tagging_tools_synonyms'))));
qa_opt('tagging_tools_prevent', (int) qa_post_text('tagging_tools_prevent'));
qa_opt('tagging_tools_rep', (int) qa_post_text('tagging_tools_rep'));
$saved_msg = '<div id="tagging_tools_recalc">Tag Synonyms settings saved</div>';
$saved_msg = '<div id="tagging_tools_recalc">'.qa_lang_html('taggingtools/admin_saved').'</div>';

// convert all old tags based on synonyms
if (qa_post_text('tagging_tools_convert')) {
$saved_msg = '<div id="tagging_tools_recalc">Editing tags...</div>';
$saved_msg = '<div id="tagging_tools_recalc">'.qa_lang_html('taggingtools/recalc_start').'</div>';
$js = file_get_contents($this->directory.'/tag-admin.js');

$replace = array(
Expand All @@ -116,30 +119,30 @@ public function admin_form(&$qa_content)

'fields' => array(
array(
'label' => 'Tag Synonyms',
'label' => qa_lang_html('taggingtools/admin_synonyms'),
'tags' => 'name="tagging_tools_synonyms" id="tagging_tools_synonyms"',
'value' => qa_opt('tagging_tools_synonyms'),
'type' => 'textarea',
'rows' => 20,
'note' => 'Put each pair of synonyms on a new line. <code>q2a,question2answer</code> means that a tag of <code>q2a</code> will be replaced by <code>question2answer</code>, while <code>help</code> on its own means that tag will be removed.',
'note' => qa_lang_html('taggingtools/admin_synonyms_note'),
),
array(
'label' => 'Also convert existing tags using above rules',
'label' => qa_lang_html('taggingtools/admin_convert'),
'tags' => 'name="tagging_tools_convert" id="tagging_tools_convert"',
'value' => '',
'type' => 'checkbox',
),

array(
'label' => 'Prevent new users from creating new tags',
'label' => qa_lang_html('taggingtools/admin_prevent'),
'tags' => 'name="tagging_tools_prevent" id="tagging_tools_prevent"',
'value' => qa_opt('tagging_tools_prevent'),
'type' => 'checkbox',
),

array(
'label' => qa_lang_html('taggingtools/admin_minpoints'),
'id' => 'tagging_tools_rep',
'label' => 'Minimum reputation to create new tags',
'value' => qa_opt('tagging_tools_rep'),
'tags' => 'name="tagging_tools_rep"',
'type' => 'number',
Expand All @@ -153,7 +156,7 @@ public function admin_form(&$qa_content)

'buttons' => array(
array(
'label' => 'Save Changes',
'label' => qa_lang_html('main/save_button'),
'tags' => 'name="tagging_tools_save_button"',
),
),
Expand Down
13 changes: 12 additions & 1 deletion qa-tt-lang-default.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,19 @@

return array(

'tag_not_usable' => 'The tag <q>^1</q> does not exist; you need ^2 points to create new tags.',
// client-side
'tag_not_usable_js' => 'The tag <q>^1</q> does not exist; you need ^2 points to create new tags.',
// server-side
'tags_not_usable' => 'You need ^1 points to create new tags. The following tags are not allowed: ^2',

'admin_saved' => 'Tag Synonyms settings saved',
'admin_synonyms' => 'Tag Synonyms',
'admin_synonyms_note' => 'Put each pair of synonyms on a new line. <code>q2a,question2answer</code> means that a tag of <code>q2a</code> will be replaced by <code>question2answer</code>, while <code>help</code> on its own means that tag will be removed.',
'admin_convert' => 'Also convert existing tags using above rules',
'admin_prevent' => 'Prevent new users from creating new tags',
'admin_minpoints' => 'Minimum reputation to create new tags',

'recalc_start' => 'Editing tags...',
'recalc_progress' => 'Editing tags... ^1 posts remaining...',
'recalc_error' => 'There was an error editing the tags.',
'recalc_done' => 'All tags edited!',
Expand Down
2 changes: 1 addition & 1 deletion qa-tt-layer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function head_script()
$replace = array(
'VAR_TAG_SEPARATOR' => qa_opt('tag_separator_comma') ? qa_js(',') : qa_js(' '),
'VAR_TAG_POINTS' => number_format(qa_opt('tagging_tools_rep')),
'VAR_TAG_ERROR' => qa_js(qa_lang('taggingtools/tag_not_usable')),
'VAR_TAG_ERROR' => qa_js(qa_lang('taggingtools/tag_not_usable_js')),
);
$js = file_get_contents(QA_HTML_THEME_LAYER_DIRECTORY.'/tag-filter.js');
$js = strtr($js, $replace);
Expand Down

0 comments on commit 409ff43

Please sign in to comment.