diff --git a/.gitignore b/.gitignore index 8a37ec621..7efd6da3d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,8 @@ /public/hot /public/storage /public/vendor/horizon +/public/_lang +/public/js /storage/*.key /storage/docker /vendor diff --git a/app/Console/Commands/ExportLanguages.php b/app/Console/Commands/ExportLanguages.php deleted file mode 100644 index be315cc44..000000000 --- a/app/Console/Commands/ExportLanguages.php +++ /dev/null @@ -1,74 +0,0 @@ -error('This command is meant for development purposes and should only be run in a local environment'); - return Command::FAILURE; - } - - $path = base_path('resources/lang'); - $langs = []; - - foreach (new \DirectoryIterator($path) as $io) { - $name = $io->getFilename(); - $skip = ['vendor']; - if($io->isDot() || in_array($name, $skip)) { - continue; - } - - if($io->isDir()) { - array_push($langs, $name); - } - } - - $exportDir = resource_path('assets/js/i18n/'); - $exportDirAlt = public_path('_lang/'); - - foreach($langs as $lang) { - $strings = \Lang::get('web', [], $lang); - $json = json_encode($strings, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES); - $path = "{$exportDir}{$lang}.json"; - file_put_contents($path, $json); - $pathAlt = "{$exportDirAlt}{$lang}.json"; - file_put_contents($pathAlt, $json); - } - - return Command::SUCCESS; - } -} diff --git a/build.xml b/build.xml new file mode 100644 index 000000000..7d49d435e --- /dev/null +++ b/build.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build/lib/i18n.php b/build/lib/i18n.php new file mode 100644 index 000000000..339278dbe --- /dev/null +++ b/build/lib/i18n.php @@ -0,0 +1,108 @@ +lang_code); + $json = json_encode($strings, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); + $path = "{DIRECTORIES::get().export}{$this->lang_code}.json"; + file_put_contents($path, $json); + $pathAlt = "{DIRECTORIES::get().exportAlt}{$this->lang_code}.json"; + file_put_contents($pathAlt, $json); + } + + private function __construct(string $code) { + $this->lang_code = $code; + $this->rootPath = base_path('resources/lang') . '/' . $code; + } +}; + +class LanguageCodes { + /** + * By scanning the translation resources folder, builds + * a list of all currently defined translation languages. + * + * @return array[] Language codes for all defined translations + */ + public static function GetAllDefined() { + foreach (new \DirectoryIterator($path) as $io) { + $name = $io->getFilename(); + $skip = ['vendor']; + if($io->isDot() || in_array($name, $skip)) { + continue; + } + + if($io->isDir()) { + array_push($langs, $name); + } + } + } +}; + +/** + * This singleton class efficiently stores and + * tracks directories used in various operations + * of i18n. + */ +class DIRECTORIES { + private static $instance; + + // enforce singleton pattern + protected function __construct() { + $this->export = resource_path('assets/js/i18n/'); + $this->exportAlt = public_path('_lang/'); + } + + protected function __clone() { } + public function __wakeup() + { throw new \Exception("Cannot unserialize a singleton."); } + + public static function get(): DIRECTORIES { + if(!isset(self::$instance)) { + self::$instance = new DIRECTORIES(); + } + + return self::$instance; + } + + public $export; + public $exportAlt; +} diff --git a/build/phing/tasks/pixelfed/i18n/generate.php b/build/phing/tasks/pixelfed/i18n/generate.php new file mode 100644 index 000000000..7e51cc509 --- /dev/null +++ b/build/phing/tasks/pixelfed/i18n/generate.php @@ -0,0 +1,18 @@ +=12.0.0", @@ -10993,13 +10993,13 @@ }, "require-dev": { "larastan/larastan": "^2.9.8", - "laravel/framework": "^11.16.0", - "laravel/pint": "^1.16.2", - "laravel/sail": "^1.30.2", + "laravel/framework": "^11.19.0", + "laravel/pint": "^1.17.1", + "laravel/sail": "^1.31.0", "laravel/sanctum": "^4.0.2", "laravel/tinker": "^2.9.0", - "orchestra/testbench-core": "^9.2.1", - "pestphp/pest": "^2.34.9 || ^3.0.0", + "orchestra/testbench-core": "^9.2.3", + "pestphp/pest": "^2.35.0 || ^3.0.0", "sebastian/environment": "^6.1.0 || ^7.0.0" }, "type": "library", @@ -11062,7 +11062,7 @@ "type": "patreon" } ], - "time": "2024-07-16T22:41:01+00:00" + "time": "2024-08-03T15:32:23+00:00" }, { "name": "phar-io/manifest", @@ -11182,6 +11182,118 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "phing/phing", + "version": "2.17.4", + "source": { + "type": "git", + "url": "https://github.com/phingofficial/phing.git", + "reference": "9f3bc8c72e65452686dcf64497e02a082f138908" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phingofficial/phing/zipball/9f3bc8c72e65452686dcf64497e02a082f138908", + "reference": "9f3bc8c72e65452686dcf64497e02a082f138908", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "ext-pdo_sqlite": "*", + "mikey179/vfsstream": "^1.6", + "pdepend/pdepend": "2.x", + "pear/archive_tar": "1.4.x", + "pear/http_request2": "dev-trunk", + "pear/net_growl": "dev-trunk", + "pear/pear-core-minimal": "1.10.1", + "pear/versioncontrol_git": "@dev", + "pear/versioncontrol_svn": "~0.5", + "phpdocumentor/phpdocumentor": "2.x", + "phploc/phploc": "~2.0.6", + "phpmd/phpmd": "~2.2", + "phpunit/phpunit": ">=3.7", + "sebastian/git": "~1.0", + "sebastian/phpcpd": "2.x", + "siad007/versioncontrol_hg": "^1.0", + "simpletest/simpletest": "^1.1", + "squizlabs/php_codesniffer": "~2.2", + "symfony/yaml": "^2.8 || ^3.1 || ^4.0" + }, + "suggest": { + "pdepend/pdepend": "PHP version of JDepend", + "pear/archive_tar": "Tar file management class", + "pear/versioncontrol_git": "A library that provides OO interface to handle Git repository", + "pear/versioncontrol_svn": "A simple OO-style interface for Subversion, the free/open-source version control system", + "phpdocumentor/phpdocumentor": "Documentation Generator for PHP", + "phploc/phploc": "A tool for quickly measuring the size of a PHP project", + "phpmd/phpmd": "PHP version of PMD tool", + "phpunit/php-code-coverage": "Library that provides collection, processing, and rendering functionality for PHP code coverage information", + "phpunit/phpunit": "The PHP Unit Testing Framework", + "sebastian/phpcpd": "Copy/Paste Detector (CPD) for PHP code", + "siad007/versioncontrol_hg": "A library for interfacing with Mercurial repositories.", + "tedivm/jshrink": "Javascript Minifier built in PHP" + }, + "bin": [ + "bin/phing" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.16.x-dev" + } + }, + "autoload": { + "classmap": [ + "classes/phing/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "classes" + ], + "license": [ + "LGPL-3.0-only" + ], + "authors": [ + { + "name": "Michiel Rook", + "email": "mrook@php.net" + }, + { + "name": "Phing Community", + "homepage": "https://www.phing.info/trac/wiki/Development/Contributors" + } + ], + "description": "PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.", + "homepage": "https://www.phing.info/", + "keywords": [ + "build", + "phing", + "task", + "tool" + ], + "support": { + "irc": "irc://irc.freenode.net/phing", + "issues": "https://www.phing.info/trac/report", + "source": "https://github.com/phingofficial/phing/tree/2.17.4" + }, + "funding": [ + { + "url": "https://github.com/mrook", + "type": "github" + }, + { + "url": "https://github.com/siad007", + "type": "github" + }, + { + "url": "https://www.patreon.com/michielrook", + "type": "patreon" + } + ], + "time": "2022-07-08T09:07:07+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "11.0.5", @@ -11507,16 +11619,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.2.8", + "version": "11.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a7a29e8d3113806f18f99d670f580a30e8ffff39" + "reference": "a8dce73a8938dfec7ac0daa91bdbcaae7d7188a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a7a29e8d3113806f18f99d670f580a30e8ffff39", - "reference": "a7a29e8d3113806f18f99d670f580a30e8ffff39", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a8dce73a8938dfec7ac0daa91bdbcaae7d7188a3", + "reference": "a8dce73a8938dfec7ac0daa91bdbcaae7d7188a3", "shasum": "" }, "require": { @@ -11555,7 +11667,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "11.2-dev" + "dev-main": "11.3-dev" } }, "autoload": { @@ -11587,7 +11699,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.8" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.3.0" }, "funding": [ { @@ -11603,7 +11715,7 @@ "type": "tidelift" } ], - "time": "2024-07-18T14:56:37+00:00" + "time": "2024-08-02T03:56:43+00:00" }, { "name": "sebastian/cli-parser", diff --git a/phpunit.xml b/phpunit.xml index 2d9fa2676..f897a9c62 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -15,7 +15,7 @@ ./app - + # ./tests/Feature diff --git a/resources/assets/components/partials/profile/ProfileSidebar.vue b/resources/assets/components/partials/profile/ProfileSidebar.vue index 7f263aec1..4eabb2e62 100644 --- a/resources/assets/components/partials/profile/ProfileSidebar.vue +++ b/resources/assets/components/partials/profile/ProfileSidebar.vue @@ -124,14 +124,14 @@ class="btn btn-link stat-item" @click="toggleTab('followers')"> {{ formatCount(profile.followers_count) }} - {{ $t('profile.followers') }} + {{ $tc('profile.relationship.followerCount', profile.followers_count) }} @@ -141,9 +141,9 @@ - +