Fixed: Multi line CA stock comments wouldn't properly translate
Added: language honor pending status
This commit is contained in:
Squidly271 2022-10-13 11:57:50 -04:00
parent 0fbb8f0122
commit c5b7f6f198
5 changed files with 38 additions and 6 deletions

View File

@ -1260,6 +1260,20 @@ function hidePluginPending(pluginURL) {
}
}
function hideLanguagePending(language) {
language.replace("lang-","");
language.replace(".xml","");
if ( ! language )
return;
$(".actionsButton").each(function() {
if ( $(this).data("languagepack") == language ) {
$(this).hide();
}
});
}
function OpenSidebarAndRefreshDisplay() {
post({action:"onStartupScreen"},function(result) {
if (result.status) {
@ -2433,6 +2447,7 @@ function CAswitchLanguage(language) {
}
function installLanguage(languageURL,language) {
hideLanguagePending(language);
disableSearch();
<?if ($nchanCom):?>
ca_openPlugin('language install '+languageURL,"<?tr('Install Language Pack')?>",'','postLanguageRefresh');
@ -2442,6 +2457,7 @@ function installLanguage(languageURL,language) {
}
function updateLanguage(language) {
hideLanguagePending(language);
disableSearch();
$.cookie("updateLanguage",language,{SameSite:'Lax'});
<?if ($nchanCom):?>
@ -2469,6 +2485,7 @@ function postUpdateLanguage() {
}
}
function removeLanguage(language) {
hideLanguagePending(language);
closeSidebar();
<?if ($nchanCom):?>
ca_openPlugin('language remove '+language,"<?tr('Remove Language Pack')?>",'','postLanguageRemove');

View File

@ -1,8 +1,8 @@
59496037fb6375e3f0e8ca11da999d8a ./Apps.page
4ae8fb652e1982d168d41313767166d4 ./Apps.page
4e55f7483b661af21a25b677179baffe ./CA_notices.page
4c5d4598e1bafa46bd90c27cbe302122 ./ca_settings.page
e8d29607ec792ddf9f6832b10ee70fdc ./default.cfg
707455867165655b1ef26315dcf224c5 ./include/exec.php
b8c45b1d0a811026b8d078a906e758c7 ./include/exec.php
f25b1ed0b1cddfb4ff95a10ced212a0d ./include/helpers.php
116042a918060278e77379b0dd73482c ./include/paths.php
532fffdf939594c143e679da02bd841e ./javascript/libraries.js
@ -22,4 +22,4 @@ da3b4f9b73c5c3bf65be6c42d68b51f9 ./scripts/showStatistics.php
34554a56611dfe625889c82afd5138de ./scripts/updatePluginSupport.php
25bdaed6f62ac73f9ef7c3ce0c125ef7 ./skins/Narrow/css.php
7eb021a105e2f7a15675ec8a14e6f05e ./skins/Narrow/skin.html
30432b07beef03988cb3828f81d5ae0b ./skins/Narrow/skin.php
794680c08b098d34610b5fadbcdf4702 ./skins/Narrow/skin.php

View File

@ -276,7 +276,14 @@ function DownloadApplicationFeed() {
$o['SortName'] = preg_replace('/\s+/',' ',$o['SortName']);
$o['random'] = rand();
if ( $o['CAComment'] ) $o['CAComment'] = tr($o['CAComment']);
if ( $o['CAComment'] ) {
$tmpComment = explode("&zwj;",$o['CAComment']); // non printable delimiter character
unset($o['CAComment']);
foreach ($tmpComment as $comment) {
if ( $comment )
$o['CAComment'] .= tr($comment)." ";
}
}
if ( $o['RequiresFile'] ) $o['RequiresFile'] = trim($o['RequiresFile']);
if ( $o['Requires'] ) $o['Requires'] = trim($o['Requires']);

View File

@ -305,6 +305,10 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
$actionsContext[] = array("icon"=>"ca_fa-delete","text"=>tr("Remove Language Pack"),"action"=>"removeLanguage('$countryCode');");
}
}
if ( file_exists($caPaths['pluginPending'].$template['LanguagePack']) || file_exists("{$caPaths['pluginPending']}lang-{$template['LanguagePack']}.xml") ) {
unset($actionsContext);
$actionsContext[] = array("text"=>tr("Pending"));
}
}
$template['actionsContext'] = $actionsContext;
@ -739,6 +743,10 @@ function getPopupDescriptionSkin($appNumber) {
} else {
unset($template['Changes']);
}
if ( file_exists($caPaths['pluginPending'].$template['LanguagePack']) || file_exists("{$caPaths['pluginPending']}lang-{$template['LanguagePack']}.xml") ) {
unset($actionsContext);
$actionsContext[] = array("text"=>tr("Pending"));
}
}
$supportContext = array();
@ -1151,10 +1159,10 @@ function displayCard($template) {
if ( $actionsContext ) {
if ( count($actionsContext) == 1) {
$dispText = $actionsContext[0]['alternate'] ?: $actionsContext[0]['text'];
$card .= "<div class='actionsButton' data-pluginURL='$PluginURL' onclick={$actionsContext[0]['action']}>$dispText</div>";
$card .= "<div class='actionsButton' data-pluginURL='$PluginURL' data-languagePack='$LanguagePack' onclick={$actionsContext[0]['action']}>$dispText</div>";
}
else
$card .= "<div class='actionsButton actionsButtonContext' data-pluginURL='$PluginURL' id='actions".preg_replace("/[^a-zA-Z0-9]+/", "",$Name)."$ID' data-context='".json_encode($actionsContext,JSON_HEX_QUOT | JSON_HEX_APOS)."'>".tr("Actions")."</div>";
$card .= "<div class='actionsButton actionsButtonContext' data-pluginURL='$PluginURL' data-languagePack='$LanguagePack' id='actions".preg_replace("/[^a-zA-Z0-9]+/", "",$Name)."$ID' data-context='".json_encode($actionsContext,JSON_HEX_QUOT | JSON_HEX_APOS)."'>".tr("Actions")."</div>";
}
$card .= "<span class='$appType' title='".htmlentities($typeTitle)."'></span>";