Skip to content

Commit

Permalink
Custom updates
Browse files Browse the repository at this point in the history
  • Loading branch information
richardDobron committed Nov 7, 2023
1 parent a6ecd7f commit d4833b7
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -15,10 +15,10 @@ FBT is an internationalization framework for PHP designed to be not just **power

**This library is based on the JavaScript implementation of Facebook's [FBT][link-facebook-fbt].**

<img src="/docs/intro.png" alt="FBT intro"/>
<img src="/docs/plurals.png" alt="FBT plurals"/>
<img src="/docs/enum.png" alt="FBT enum"/>
<img src="/docs/pronouns.png" alt="FBT pronouns"/>
<img src="docs/intro.png" alt="FBT intro"/>
<img src="docs/plurals.png" alt="FBT plurals"/>
<img src="docs/enum.png" alt="FBT enum"/>
<img src="docs/pronouns.png" alt="FBT pronouns"/>

## Requirements
* PHP 7.0 or higher
Expand Down
2 changes: 1 addition & 1 deletion docs/collection.md
Expand Up @@ -44,7 +44,7 @@ can produce the translated payloads `fbt::_()` expects.

When it comes to moving from source text to translations, what is most
pertinent is the `hashToText` payload containing all relevant texts
with their identifying hash. You can choose `md5` or `tiger` hash module. It defaults to md5.
with their identifying hash. You can choose `md5` or `tiger` hash module. It defaults to `md5`.

### A note on hashes

Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started.md
Expand Up @@ -41,7 +41,7 @@ Below are the less important parameters.

* **collectFbt** `bool`: (Default: `true`) Collect fbt instances from the source and store them to a JSON file.
* **prettyPrint** `bool`: (Default: `true`) Pretty print source strings in a JSON file.
* **hash_module** `string`: (Default: `md5`) Hash module.
* **hash_module** `string`: (Default: `md5`) Hash module. You can choose `md5` or `tiger` hash module.
* **md5_digest** `string`: (Default: `hex`) MD5 digest.
* **driver** `string`: (Default: `json`) Currently, only JSON storage is supported.

Expand Down
1 change: 1 addition & 0 deletions src/fbt/FbtConfig.php
Expand Up @@ -113,6 +113,7 @@ public static function set(string $key, $value)
}

/**
* @param array $config
* @return void
* @throws FbtInvalidConfigurationException
*/
Expand Down
2 changes: 1 addition & 1 deletion src/fbt/Runtime/Gender.php
Expand Up @@ -191,7 +191,7 @@ class Gender
],
];

public static function getData($gender, $usage)
public static function getData(string $gender, string $usage)
{
$data = self::DATA;

Expand Down
8 changes: 4 additions & 4 deletions src/fbt/Services/TranslationsGeneratorService.php
Expand Up @@ -135,7 +135,7 @@ private function processTranslations(array $fbtSites, array $group): array
/**
* @throws \fbt\Exceptions\FbtException
*/
private function processGroups($phrases, $translatedGroups): array
private function processGroups(array $phrases, array $translatedGroups): array
{
$localeToHashToFbt = [];

Expand All @@ -156,12 +156,12 @@ private function processGroups($phrases, $translatedGroups): array
* Generate missing translation hashes from collected source strings
*
* @param string $source
* @param $translationsPath
* @param $inputPath
* @param string|null $translationsPath
* @param string $inputPath
*
* @throws \Exception
*/
public function generateTranslations(string $source, $translationsPath, $inputPath)
public function generateTranslations(string $source, ?string $translationsPath, string $inputPath)
{
if (! file_exists($source)) {
throw new \Exception('Source strings file does not exist: ' . $source);
Expand Down
8 changes: 4 additions & 4 deletions src/fbt/Transform/FbtHash.php
Expand Up @@ -19,9 +19,9 @@ class FbtHash
*
* [["hash1", "hash2", ...]]
*/
public static function md5($phrases): array
public static function md5(array $phrases): array
{
return array_map(function ($phrase) {
return array_map(function (array $phrase) {
return array_map(
function ($text) use ($phrase) {
$md5 = md5($text . $phrase['desc']);
Expand Down Expand Up @@ -60,9 +60,9 @@ function ($text) use ($phrase) {
* ["hash1", "hash2", ...], // hashes for strings of phrase N
* ]
*/
public static function tiger($phrases): array
public static function tiger(array $phrases): array
{
return array_map(function ($phrase) {
return array_map(function (array $phrase) {
return array_map(
function ($text) use ($phrase) {
return FbtTransform\fbtHash::oldTigerHash($text . ':::' . $phrase['desc'] . ':');
Expand Down

0 comments on commit d4833b7

Please sign in to comment.