Skip to content

Commit d339300

Browse files
[Intl] Compress emoji and data maps
1 parent 1414ff4 commit d339300

File tree

2,763 files changed

+105
-796779
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,763 files changed

+105
-796779
lines changed

src/Symfony/Component/Intl/Data/Bundle/Reader/PhpBundleReader.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Intl\Data\Bundle\Reader;
1313

1414
use Symfony\Component\Intl\Exception\ResourceBundleNotFoundException;
15+
use Symfony\Component\Intl\Util\GzipStreamWrapper;
1516

1617
/**
1718
* Reads .php resource bundles.
@@ -31,6 +32,10 @@ public function read(string $path, string $locale): mixed
3132
throw new ResourceBundleNotFoundException(sprintf('The resource bundle "%s" does not exist.', $fileName));
3233
}
3334

35+
if (is_file($fileName.'.gz')) {
36+
return GzipStreamWrapper::require($fileName.'.gz');
37+
}
38+
3439
if (!is_file($fileName)) {
3540
throw new ResourceBundleNotFoundException(sprintf('The resource bundle "%s" does not exist.', $fileName));
3641
}

src/Symfony/Component/Intl/Data/Bundle/Writer/PhpBundleWriter.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,13 @@ public function write(string $path, string $locale, mixed $data): void
4848
$data = sprintf($template, $data);
4949

5050
file_put_contents($path.'/'.$locale.'.php', $data);
51+
52+
if ('meta' === $locale || 'en' === $locale) {
53+
return;
54+
}
55+
56+
file_put_contents('compress.zlib://'.$path.'/'.$locale.'.php.gz', $data);
57+
58+
unlink($path.'/'.$locale.'.php'.(filesize($path.'/'.$locale.'.php.gz') >= filesize($path.'/'.$locale.'.php') ? '.gz' : ''));
5159
}
5260
}

0 commit comments

Comments
 (0)