Skip to content

Commit

Permalink
Add some preview strings
Browse files Browse the repository at this point in the history
  • Loading branch information
bloatware committed Dec 9, 2023
1 parent 4936043 commit 867b977
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions textpattern/lang/en.ini
Expand Up @@ -202,9 +202,11 @@ article_saved_draft="Article saved as draft."
article_saved_hidden="Article saved as hidden."
article_saved_pending="Article saved as pending."
article_save_failed="The article was not saved due to an error. Please try again."
clean_preview="Sanitize"
comment_settings="Comment options"
concurrent_edit_by="Article <strong>not</strong> saved. {author} modified the article while you were editing it. If you’re sure, press the ‘Save’ button once more."
excerpt_markup="Excerpt markup"
found_unsafe="Found {tags} txp tags and {elements} unsafe elements."
override_default_form="Override form"
problem_creating_article="There was a problem creating the article."
problem_deleting_article="There was a problem deleting the article."
Expand Down
1 change: 1 addition & 0 deletions textpattern/lib/txplib_head.php
Expand Up @@ -93,6 +93,7 @@ function pagetop($pagetitle = '', $message = '')
'documentation',
'excerpt',
'form_submission_error',
'found_unsafe',
'help',
'list_options',
'ok',
Expand Down
6 changes: 5 additions & 1 deletion textpattern/textpattern.js
Expand Up @@ -2186,7 +2186,11 @@ textpattern.Route.add('article', function () {

if (ntags || DOMPurify.removed.length) {
// DOMPurify.removed.forEach(item => console.log(item));
textpattern.Console.addMessage([`Found ${ntags} txp tags and ${DOMPurify.removed.length} unsafe elements`, 2], "preview");
const message = textpattern.gTxt('found_unsafe', {
'{tags}': ntags, '{elements}': DOMPurify.removed.length
});
// textpattern.Console.addMessage([`Found ${ntags} txp tags and ${DOMPurify.removed.length} unsafe elements`, 2], "preview");
textpattern.Console.addMessage([message, 2], "preview");
}
}

Expand Down
6 changes: 5 additions & 1 deletion textpattern/vendors/Textpattern/L10n/Lang.php
Expand Up @@ -738,8 +738,12 @@ public function txt($var, $atts = array(), $escape = 'html')

if (isset($this->strings[$v])) {
$out = $this->strings[$v];
} elseif (isset($textarray[$v])) {
$out = $textarray[$v];
} else {
$out = isset($textarray[$v]) ? $textarray[$v] : '';
$out = $this->strings[$v] = $textarray[$v] = in_array(TEXTPATTERN_DEFAULT_LANG, $this->installed()) ?

This comment has been minimized.

Copy link
@bloatware

bloatware Dec 9, 2023

Author Member

This change is temporary, just to avoid untranslated strings. We should find something more efficient.

(string)safe_field("data", 'txp_lang', "name='".doSlash($v)."' AND lang='".doSlash(TEXTPATTERN_DEFAULT_LANG)."'") :
'';
}

if ($atts && $escape == 'html') {
Expand Down

0 comments on commit 867b977

Please sign in to comment.