fixing html encoding issue in i18n

This commit is contained in:
vineethvk11 2024-03-23 13:52:50 +05:30
parent 4981d1c490
commit f1742faa24
4 changed files with 4 additions and 7 deletions

View File

@ -29,7 +29,7 @@ async function PuterDialog(options) {
<button class="button button-auth" id="launch-auth-popup-cancel">${i18n('cancel')}</button> <button class="button button-auth" id="launch-auth-popup-cancel">${i18n('cancel')}</button>
<button class="button button-primary button-auth" id="launch-auth-popup" style="margin-left:10px;">${i18n('continue')}</button> <button class="button button-primary button-auth" id="launch-auth-popup" style="margin-left:10px;">${i18n('continue')}</button>
</div> </div>
<p style="text-align: center; font-size: 14px;">${i18n('powered_by_puter_js')}</p> <p style="text-align: center; font-size: 14px;">${i18n('powered_by_puter_js', [], false)}</p>
<p class="launch-auth-popup-footnote">${i18n('tos_fineprint')}</p> <p class="launch-auth-popup-footnote">${i18n('tos_fineprint')}</p>
</div>`; </div>`;

View File

@ -26,7 +26,7 @@ async function UIWindowPublishWebsite(target_dir_uid, target_dir_name, target_di
// success // success
h += `<div class="window-publishWebsite-success">`; h += `<div class="window-publishWebsite-success">`;
h += `<img src="${html_encode(window.icons['c-check.svg'])}" style="width:80px; height:80px; display: block; margin:10px auto;">`; h += `<img src="${html_encode(window.icons['c-check.svg'])}" style="width:80px; height:80px; display: block; margin:10px auto;">`;
h += `<p style="text-align:center;">${i18n('dir_published_as_website', `<strong>${target_dir_name}</strong>`)}<p>`; h += `<p style="text-align:center;">${i18n('dir_published_as_website', `<strong>${target_dir_name}</strong>`, false)}<p>`;
h += `<p style="text-align:center;"><a class="publishWebsite-published-link" target="_blank"></a><img class="publishWebsite-published-link-icon" src="${html_encode(window.icons['launch.svg'])}"></p>`; h += `<p style="text-align:center;"><a class="publishWebsite-published-link" target="_blank"></a><img class="publishWebsite-published-link-icon" src="${html_encode(window.icons['launch.svg'])}"></p>`;
h += `<button class="button button-normal button-block button-primary publish-window-ok-btn" style="margin-top:20px;">OK</button>`; h += `<button class="button button-normal button-block button-primary publish-window-ok-btn" style="margin-top:20px;">OK</button>`;
h+= `</div>`; h+= `</div>`;

View File

@ -64,7 +64,7 @@ function UIWindowSignup(options){
h += `<input type="text" name="p102xyzname" class="p102xyzname" value="">`; h += `<input type="text" name="p102xyzname" class="p102xyzname" value="">`;
// terms and privacy // terms and privacy
h += `<p class="signup-terms">${i18n('tos_fineprint', false)}</p>`; h += `<p class="signup-terms">${i18n('tos_fineprint', [], false)}</p>`;
// Create Account // Create Account
h += `<button class="signup-btn button button-primary button-block button-normal">${i18n('create_free_account')}</button>` h += `<button class="signup-btn button button-primary button-block button-normal">${i18n('create_free_account')}</button>`
h += `</form>`; h += `</form>`;

View File

@ -21,10 +21,7 @@ import translations from './translations/translations.js';
window.ListSupportedLanguages = () => Object.keys(translations).map(lang => translations[lang]); window.ListSupportedLanguages = () => Object.keys(translations).map(lang => translations[lang]);
window.i18n = function (key, replacements = [], encode_html = true) { window.i18n = function (key, replacements = [], encode_html = true) {
if(typeof replacements === 'boolean' && encode_html === undefined){ if(Array.isArray(replacements) === false){
encode_html = replacements;
replacements = [];
}else if(Array.isArray(replacements) === false){
replacements = [replacements]; replacements = [replacements];
} }