Example #1
0
     include MODELS . 'locale_model.php';
     $json = [];
     if ($request['store'] == 'google') {
         $json = ['title' => $app_title($translate), 'short_desc' => $short_desc($translate), 'long_desc' => str_replace(["\r", "\n"], "\n", $description($translate))];
     }
     if ($request['store'] == 'apple') {
         $json = ['title' => $app_title($translate), 'description' => strip_tags(br2nl($description($translate))), 'keywords' => $keywords($translate), 'screenshots' => $screenshots_api];
     }
     break;
 case 'done':
     $done = [];
     $view = 'api';
     foreach ($project->getFirefoxLocales($request->query['store'], $request->query['channel']) as $lang) {
         $translate = new Translate($lang, $project->getLangFile($request->query['store'], $request->query['channel']));
         $translate::$log_errors = false;
         if ($translate->isFileTranslated()) {
             $set_limit = function ($limit, $string) {
                 return mb_strlen(trim(strip_tags($string))) <= $limit;
             };
             // The Google Store has string lengths constraints
             if ($request->query['store'] == 'google') {
                 // Include the current template
                 require TEMPLATES . $project->getTemplate('google', $request->query['channel']);
                 $desc = $set_limit(4000, $description($translate));
                 $title = $set_limit(30, $app_title($translate));
                 $short_desc = $set_limit(80, $short_desc($translate));
                 if ($desc && $title && $short_desc) {
                     $done[] = $lang;
                 }
             } elseif ($request->query['store'] == 'apple') {
                 // Include the current template
Example #2
0
<?php

namespace Stores;

// Compute the completion status for all locales
$status = [];
// Don't log missing lang files
\Langchecker\DotLangParser::$log_errors = false;
$get_status = function ($lang_file, $store_locales) {
    foreach ($store_locales as $lang) {
        $obj = new Translate($lang, $lang_file);
        $status[$lang] = $obj->isFileTranslated() ? 'translated' : '';
    }
    return $status;
};
$status['google']['release'] = $get_status($project->getLangFile('google', 'release'), $project->getGoogleMozillaCommonLocales('release'));
$status['google']['beta'] = $get_status($project->getLangFile('google', 'beta'), $project->getGoogleMozillaCommonLocales('beta'));
$status['google']['next'] = $get_status($project->getLangFile('google', 'next'), $project->getGoogleMozillaCommonLocales('next'));
$status['apple']['release'] = $get_status($project->getLangFile('apple', 'release'), $project->getAppleMozillaCommonLocales('release'));
$html_table = function ($table_id, $table_title, $store, $channel) use($status, $project) {
    ob_start();
    ?>
        <table id="<?php 
    echo $table_id;
    ?>
" class="table table-bordered table-condensed table-striped">
        <tr>
            <th class="text-center" colspan="5"><?php 
    echo $table_title;
    ?>
</th>