From afd9cc8f98f835604c122691626f573f3099ad1c Mon Sep 17 00:00:00 2001 From: Deeka Wong Date: Wed, 1 Jan 2025 00:32:31 +0800 Subject: [PATCH] ci: add step to get changes in docs translation workflow (#823) * ci: add step to get changes in docs translation workflow * ci: update get changes step to use HEAD reference * docs: add more tag to about.md for content separation * Update docs and translate * ci: update get changes step in docs translation workflow docs: add more content separation in about.md * Update docs and translate * ci: refine get changes step to filter for docs directory; update about.md more tag * ci: update get changes step in docs translation workflow; modify more tag in about.md * ci: update get changes step to save output to changes.txt and display its content * Update docs and translate * ci: update get changes step to directly save output to changes.txt; modify more tag in about.md * ci: update get changes step to include branch context and refine output; modify more tag in about.md * ci: update docs translation workflow to list all changed markdown files and modify more tag in about.md * Update docs and translate * ci: update translation workflow to only translate changed markdown files and adjust more tag in about.md * Update docs and translate * ci: update translation workflow to include all markdown files and modify more tag in about.md * Update docs and translate * ci: update workflow to improve markdown file handling and enhance naming consistency * docs: update more tag in about.md for consistency * Update docs and translate --------- Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com> Co-authored-by: huangdijia --- en/components/amqp-job.md | 2 +- en/components/command-signals.md | 4 ++-- en/components/command-validation.md | 2 +- en/components/compoships.md | 10 +++++----- en/components/config-consul.md | 2 +- en/components/console-spinner.md | 4 ++-- en/components/fast-paginate.md | 4 ++-- en/components/http-client.md | 2 +- en/components/http-logger.md | 2 +- en/components/lock.md | 4 ++-- en/components/model-hashids.md | 18 +++++++++--------- en/components/model-morph-addon.md | 2 +- en/components/model-observer.md | 2 +- en/components/notification-easysms.md | 2 +- en/components/notification-mail.md | 4 ++-- en/components/notification.md | 7 ++++--- en/components/purifier.md | 2 +- en/components/redis-subscriber.md | 6 +++--- en/components/sentry.md | 4 ++-- en/components/tcp-sender.md | 3 +-- en/components/telescope-elasticsearch.md | 2 +- en/components/validated-dto.md | 18 +++++++++--------- en/components/web-tinker.md | 2 +- en/guide/introduce/about.md | 4 +++- en/guide/start/components.md | 2 +- en/index.md | 4 ++-- zh-cn/guide/introduce/about.md | 2 ++ zh-hk/guide/introduce/about.md | 2 ++ zh-tw/guide/introduce/about.md | 2 ++ 29 files changed, 66 insertions(+), 58 deletions(-) diff --git a/en/components/amqp-job.md b/en/components/amqp-job.md index 9ed9632..ce0ddbb 100644 --- a/en/components/amqp-job.md +++ b/en/components/amqp-job.md @@ -2,7 +2,7 @@ ## Introduction -`friendsofhyperf/amqp-job` is an asynchronous task component based on the `hyperf/amqp` component, which supports distributing tasks to AMQP services and then consuming them via consumers. It encapsulates the `hyperf/amqp` component, providing a more convenient way to dispatch and consume tasks. +`friendsofhyperf/amqp-job` is an asynchronous task component based on the `hyperf/amqp` component, which supports distributing tasks to the AMQP service and then consuming the tasks through consumers. It encapsulates the `hyperf/amqp` component, providing a more convenient way to distribute and consume tasks. ## Installation diff --git a/en/components/command-signals.md b/en/components/command-signals.md index a8dc460..c1f7c48 100644 --- a/en/components/command-signals.md +++ b/en/components/command-signals.md @@ -49,14 +49,14 @@ class FooCommand extends HyperfCommand ## Execution -- Manually exit by pressing `Ctrl + C` +- Press `Ctrl + C` to manually exit ```shell $ hyperf foo ^CReceived signal 2, exiting... ``` -- Kill the process using `killall php` +- Use `killall php` to terminate the process ```shell $ hyperf foo diff --git a/en/components/command-validation.md b/en/components/command-validation.md index eee8497..b8d1835 100644 --- a/en/components/command-validation.md +++ b/en/components/command-validation.md @@ -27,7 +27,7 @@ class FooCommand extends HyperfCommand use ValidatesInput; /** - * The command line to be executed. + * The command to execute. */ protected string $name = 'foo:hello {?name : The name of the person to greet.}'; diff --git a/en/components/compoships.md b/en/components/compoships.md index d8fcb7b..62db3df 100644 --- a/en/components/compoships.md +++ b/en/components/compoships.md @@ -1,10 +1,10 @@ # Compoships -**Compoships** provides the ability to specify relationships based on two (or more) columns in the Model ORM of Hyperf. When dealing with third-party or pre-existing schemas/databases, it is common to encounter situations where you need to match multiple columns in the definition of Eloquent relationships. +**Compoships** provides the ability to specify relationships based on two (or more) columns in Hyperf's Model ORM. This is particularly useful when dealing with third-party or pre-existing schemas/databases where it's common to have the need to match multiple columns in the definition of Eloquent relationships. ## The Problem -Eloquent does not support composite keys. Therefore, it is not possible to define a relationship from one model to another by matching multiple columns. Attempting to use a `where` clause (as shown in the example below) does not work when eager loading relationships because **$this->team_id** is null when the relationship is being processed. +Eloquent does not support composite keys. As a result, there is no way to define a relationship from one model to another by matching multiple columns. Attempting to use a `where` clause (as shown in the example below) does not work when eager loading relationships because **$this->team_id** is null when the relationship is being processed. ```php namespace App; @@ -23,7 +23,7 @@ class User extends Model ## Installation -It is recommended to install the **Compoships** component via [Composer](http://getcomposer.org/). +It is recommended to install **Compoships** via [Composer](http://getcomposer.org/). ```shell composer require friendsofhyperf/compoships @@ -37,7 +37,7 @@ Simply have your model class extend the `FriendsOfHyperf\Compoships\Database\Elo ### Using the `FriendsOfHyperf\Compoships\Compoships` Trait -If for some reason you cannot extend your model from `FriendsOfHyperf\Compoships\Database\Eloquent\Model`, you can utilize the `FriendsOfHyperf\Compoships\Compoships` trait. Just use the trait in your model. +If for some reason you cannot extend your model from `FriendsOfHyperf\Compoships\Database\Eloquent\Model`, you can take advantage of the `FriendsOfHyperf\Compoships\Compoships` trait. Just use the trait in your model. **Note:** To define a multi-column relationship from model *A* to another model *B*, **both models must extend `FriendsOfHyperf\Compoships\Database\Eloquent\Model` or use the `FriendsOfHyperf\Compoships\Compoships` trait** @@ -107,7 +107,7 @@ class User extends Model } ``` -The same syntax can define the inverse of the relationship: +The same syntax can be used to define the inverse of the relationship: ```php namespace App; diff --git a/en/components/config-consul.md b/en/components/config-consul.md index 5030ecf..73db5a2 100644 --- a/en/components/config-consul.md +++ b/en/components/config-consul.md @@ -1,6 +1,6 @@ # Config Consul -A Consul configuration center engine for Hyperf. +A Consul configuration center engine tailored for Hyperf. ## Installation diff --git a/en/components/console-spinner.md b/en/components/console-spinner.md index 13082b3..d6eea86 100644 --- a/en/components/console-spinner.md +++ b/en/components/console-spinner.md @@ -1,6 +1,6 @@ # Console Spinner -A progress bar component for the Hyperf framework. +A progress bar component provided for the Hyperf framework. ## Installation @@ -37,7 +37,7 @@ class FooCommand extends Command } ``` -The `$spinner` is compatible with Symfony's ProgressBar, so you can run any method of this class. Alternatively, you can also use the `withSpinner` method by providing an iterable object. +The `$spinner` is compatible with Symfony ProgressBar, so you can run any method of this class. Alternatively, you can also use the `withSpinner` method by providing an iterable object. ```php $this->withSpinner(User::all(), function($user) { diff --git a/en/components/fast-paginate.md b/en/components/fast-paginate.md index 6a80dcf..77cd990 100644 --- a/en/components/fast-paginate.md +++ b/en/components/fast-paginate.md @@ -8,7 +8,7 @@ This is a fast `limit`/`offset` pagination macro for Hyperf. It can replace the This package uses an SQL approach similar to "deferred joins" to achieve this speedup. Deferred joins are a technique where the requested columns are accessed only after applying the `offset` and `limit`. -In our case, we don't actually perform a join but use a `where in` with a subquery. Using this technique, we create a subquery that can be optimized with specific indexes for maximum speed, and then use these results to fetch the full rows. +In our case, we don't actually perform a join but use a `where in` with a subquery. Using this technique, we create a subquery that can be optimized by a specific index for maximum speed, and then use these results to fetch the full rows. The SQL statement looks like this: @@ -41,7 +41,7 @@ No additional steps are required; the service provider will be automatically loa Anywhere you would use `Model::query()->paginate()`, you can use `Model::query()->fastPaginate()`! It's that simple! The method signature is the same. -Relationships are also supported: +Relations are also supported: ```php User::first()->posts()->fastPaginate(); diff --git a/en/components/http-client.md b/en/components/http-client.md index 5687059..4ab9df9 100644 --- a/en/components/http-client.md +++ b/en/components/http-client.md @@ -18,4 +18,4 @@ $response = Http::get('https://example.com'); ## Documentation -For more information, please refer to the [Laravel HTTP Client Documentation](https://laravel.com/docs/9.x/http-client). \ No newline at end of file +For more information, please refer to the [Laravel HTTP Client documentation](https://laravel.com/docs/9.x/http-client). \ No newline at end of file diff --git a/en/components/http-logger.md b/en/components/http-logger.md index a28908c..c0f7a58 100644 --- a/en/components/http-logger.md +++ b/en/components/http-logger.md @@ -1,6 +1,6 @@ # Http Logger -An HTTP logging component for Hyperf. +A HTTP logging component for Hyperf. ## Installation diff --git a/en/components/lock.md b/en/components/lock.md index d2bf3cc..41c0480 100644 --- a/en/components/lock.md +++ b/en/components/lock.md @@ -30,7 +30,7 @@ if ($lock->get()) { } ``` -The `get` method can also accept a closure. After the closure is executed, the lock will be automatically released: +The `get` method can also accept a closure. The lock will be automatically released after the closure is executed: ```php lock('foo')->get(function () { @@ -38,7 +38,7 @@ lock('foo')->get(function () { }); ``` -If the lock is unavailable when requested, you can control the wait time in seconds. If the lock cannot be acquired within the specified time limit, a `FriendsOfHyperf\Lock\Exception\LockTimeoutException` will be thrown. +If the lock is not available when requested, you can control the number of seconds to wait. If the lock cannot be acquired within the specified time limit, a `FriendsOfHyperf\Lock\Exception\LockTimeoutException` will be thrown: ```php use FriendsOfHyperf\Lock\Exception\LockTimeoutException; diff --git a/en/components/model-hashids.md b/en/components/model-hashids.md index 7d1c259..39e9b62 100644 --- a/en/components/model-hashids.md +++ b/en/components/model-hashids.md @@ -2,7 +2,7 @@ Using hashids instead of integer IDs in URLs and list items can be more attractive and clever. For more information, visit [hashids.org](https://hashids.org/). -This package adds hashids to Hyperf models by dynamically encoding/decoding them, rather than persisting them in the database. This eliminates the need for additional database columns and allows for higher performance by using primary keys in queries. +This package adds hashids to Hyperf models by dynamically encoding/decoding them, rather than persisting them in the database. This eliminates the need for an additional database column and allows for better performance by using primary keys in queries. Features include: @@ -42,7 +42,7 @@ Class Item extends Model ### Customizing Hashid Settings -Hashid settings can be customized per model by overriding `getHashidsConnection()`. It must return the name of the connection in `config/autoload/hashids.php`. +You can customize the hashid settings for each model by overriding `getHashidsConnection()`. It must return the name of the connection in `config/autoload/hashids.php`. ## Usage @@ -77,7 +77,7 @@ $item->getHashidsConnection(); ### Adding Hashid to Serialized Models -Setting it as default: +Set it as default: ```php @@ -98,13 +98,13 @@ class Item extends Model ``` -Setting it for a specific route: +Set it for a specific route: `return $item->append('hashid')->toJson();` ### Implicit Route Binding -If you want to resolve implicit route bindings using the model's hashid value, you can use `HashidRouting` in the model. +If you want to resolve implicit route bindings using the model's hashid value, you can use `HashidRouting` in your model. ```php @@ -121,7 +121,7 @@ class Item extends Model It overrides `getRouteKeyName()`, `getRouteKey()`, and `resolveRouteBindingQuery()` to use hashids as the route key. -It supports Laravel's custom specific route key functionality. +It supports Laravel's custom specific route key feature. ```php @@ -133,7 +133,7 @@ Route::get('/items/{item:slug}', function (Item $item) { #### Customizing the Default Route Key Name -If you want to resolve implicit route bindings using another field by default, you can override `getRouteKeyName()` to return the field name during resolution and `getRouteKey()` to return its value in links. +If you want to resolve implicit route bindings using another field by default, you can override `getRouteKeyName()` to return the field name used in the resolution process and `getRouteKey()` to return its value in links. ```php @@ -158,7 +158,7 @@ class Item extends Model ``` -You can still specify hashid for specific routes. +You can still specify the hashid for specific routes. ```php @@ -170,7 +170,7 @@ Route::get('/items/{item:hashid}', function (Item $item) { #### Supporting Other Laravel Implicit Route Binding Features -When using `HashidRouting`, you can still use soft deletion and child route bindings. +When using `HashidRouting`, you can still use soft deletes and child route bindings. ```php diff --git a/en/components/model-morph-addon.md b/en/components/model-morph-addon.md index 7d207eb..388a4ec 100644 --- a/en/components/model-morph-addon.md +++ b/en/components/model-morph-addon.md @@ -1,6 +1,6 @@ # Model Morph Addon -The Model Morph Addon supports polymorphic associations in Hyperf models. +The Model Morph Addon supports polymorphic relationships in Hyperf models. ## Installation diff --git a/en/components/model-observer.md b/en/components/model-observer.md index 97588e9..991c660 100644 --- a/en/components/model-observer.md +++ b/en/components/model-observer.md @@ -1,6 +1,6 @@ # Model Observer -The Model Observer component, designed for the Hyperf framework. +The Model Observer component is designed for the Hyperf framework. ## Installation diff --git a/en/components/notification-easysms.md b/en/components/notification-easysms.md index dcf8372..e56aa57 100644 --- a/en/components/notification-easysms.md +++ b/en/components/notification-easysms.md @@ -88,7 +88,7 @@ class TestNotification extends Notification implements Smsable ]; } - // or return customer Message + // or return custom Message // public function toSms(mixed $notifiable): array|Message // { // return new Message(); diff --git a/en/components/notification-mail.md b/en/components/notification-mail.md index 7d337bf..f26cf96 100644 --- a/en/components/notification-mail.md +++ b/en/components/notification-mail.md @@ -8,7 +8,7 @@ composer require friendsofhyperf/notification-mail:~3.1.0 ## Usage -### Use `Notifiable` Trait in Model +### Use `Notifiable` trait in Model ```php warning('this is a test warning issue!'); return [ diff --git a/en/components/tcp-sender.md b/en/components/tcp-sender.md index ea96180..f423216 100644 --- a/en/components/tcp-sender.md +++ b/en/components/tcp-sender.md @@ -2,7 +2,7 @@ ## Introduction -`friendsofhyperf/tcp-sender` is a TCP service component similar to `hyperf/websocket-server`, designed to send messages to specified file descriptors (fd). It allows developers to focus on business logic without worrying about the underlying implementation details. +`friendsofhyperf/tcp-sender` is a TCP service component similar to `hyperf/websocket-server`, designed to send messages to specified file descriptors (fd). It abstracts away the underlying implementation details, allowing developers to focus solely on business logic. ## Installation @@ -144,5 +144,4 @@ class IndexController extends AbstractController ]; } } - ``` \ No newline at end of file diff --git a/en/components/telescope-elasticsearch.md b/en/components/telescope-elasticsearch.md index 803ea47..28a4488 100644 --- a/en/components/telescope-elasticsearch.md +++ b/en/components/telescope-elasticsearch.md @@ -1,6 +1,6 @@ # Telescope Elasticsearch Driver -This driver allows you to switch from an SQL database to Elasticsearch as the data storage for Telescope, eliminating deadlocks and making Telescope a production-ready logging system. +This driver allows you to switch from an SQL database to Elasticsearch as the data storage backend, eliminating deadlocks and making Telescope a production-ready logging system. ## Installation diff --git a/en/components/validated-dto.md b/en/components/validated-dto.md index c6fdd0d..a415857 100644 --- a/en/components/validated-dto.md +++ b/en/components/validated-dto.md @@ -176,7 +176,7 @@ class CreateUserCommand extends Command ## Accessing DTO Data -After creating a `DTO` instance, you can access any property as you would with an `object`: +Once you have created a `DTO` instance, you can access any property as you would with an `object`: ```php $dto = UserDTO::fromArray([ @@ -205,7 +205,7 @@ $dto->username; // This property is not available in the DTO ## Defining Default Values -Sometimes we may have optional properties that can have default values. You can define default values for `DTO` properties in the `defaults` method: +Sometimes we may have some optional properties that can have default values. You can define default values for `DTO` properties in the `defaults` method: ```php username; // 'deeka_wong' ``` -## Converting DTO Data +## Transforming DTO Data -You can convert your DTO to some formats: +You can transform your DTO into some formats: ### To Array @@ -346,7 +346,7 @@ protected function casts(): array } ``` -## Available Casts +## Available Types ### Array @@ -478,7 +478,7 @@ If the data is invalid for the DTO, this will throw a `Hyperf\Validation\Validat If the property is not a valid array or a valid JSON string, this will throw a `FriendsOfHyperf\ValidatedDTO\Exception\CastException`. -If the class passed to the `DTOCast` constructor is not an instance of `ValidatedDTO`, this will throw a `FriendsOfHyperf\ValidatedDTO\Exception\CastTargetException`. +If the class passed to the `DTOCast` constructor is not a `ValidatedDTO` instance, this will throw a `FriendsOfHyperf\ValidatedDTO\Exception\CastTargetException`. ```php protected function casts(): array @@ -521,7 +521,7 @@ This works for arrays and JSON strings. If the property is not a valid array or a valid JSON string, this will throw a `FriendsOfHyperf\ValidatedDTO\Exception\CastException`. -If the class passed to the `ModelCast` constructor is not an instance of `Model`, this will throw a `FriendsOfHyperf\ValidatedDTO\Exception\CastTargetException`. +If the class passed to the `ModelCast` constructor is not a `Model` instance, this will throw a `FriendsOfHyperf\ValidatedDTO\Exception\CastTargetException`. ```php protected function casts(): array @@ -560,7 +560,7 @@ protected function casts(): array } ``` -## Creating Your Own Casts +## Creating Your Own Cast Types You can easily create new `Castable` types for your project by implementing the `FriendsOfHyperf\ValidatedDTO\Casting\Castable` interface. This interface has one method that must be implemented: @@ -575,7 +575,7 @@ You can easily create new `Castable` types for your project by implementing the public function cast(string $property, mixed $value): mixed; ``` -Suppose you have a `URLWrapper` class in your project, and you want it to always return a `URLWrapper` instance instead of a simple string when a URL is passed to your `DTO`: +Suppose you have a `URLWrapper` class in your project, and you want it to always return a `URLWrapper` instance instead of a simple string when passing a URL to your `DTO`: ```php class URLCast implements Castable diff --git a/en/components/web-tinker.md b/en/components/web-tinker.md index cc2bcae..bb3b6c5 100644 --- a/en/components/web-tinker.md +++ b/en/components/web-tinker.md @@ -26,4 +26,4 @@ php bin/hyperf.php start ## Access -Visit `http://127.0.0.1:9501/tinker` to access the Web Tinker page. \ No newline at end of file +Visit `http://127.0.0.1:9501/tinker` to enter the Web Tinker page. \ No newline at end of file diff --git a/en/guide/introduce/about.md b/en/guide/introduce/about.md index 148e830..48dae2f 100644 --- a/en/guide/introduce/about.md +++ b/en/guide/introduce/about.md @@ -1,3 +1,5 @@ # About Hyperf Fans -Welcome to Hyperf Fans, the official documentation site for Hyperf Fans. \ No newline at end of file +Welcome to Hyperf Fans, the official documentation site for Hyperf Fans. + + \ No newline at end of file diff --git a/en/guide/start/components.md b/en/guide/start/components.md index cdb9bce..70310e0 100644 --- a/en/guide/start/components.md +++ b/en/guide/start/components.md @@ -1,6 +1,6 @@ # Components -## List of Supported Components +## Supported Components List | Repository | Stable Version | Total Downloads | Monthly Downloads | |--|--|--|--| diff --git a/en/index.md b/en/index.md index f14e412..3df078a 100644 --- a/en/index.md +++ b/en/index.md @@ -19,7 +19,7 @@ features: details: This is the Hyperf SDK for Sentry. link: /en/components/sentry/ - title: Telescope - details: Telescope is an elegant debug assistant for the Hyperf framework. + details: Telescope is an elegant debugging assistant for the Hyperf framework. link: /en/components/telescope/ - title: Tinker details: Tinker is a powerful REPL for the Hyperf framework. @@ -40,7 +40,7 @@ features: details: Validated DTO provides a simple and convenient way to validate data. link: /en/components/validated-dto/ - title: Lock - details: Lock provides a simple and convenient distributed lock functionality. + details: Lock provides a simple and convenient distributed locking mechanism. link: /en/components/lock/ - title: More details: More components… diff --git a/zh-cn/guide/introduce/about.md b/zh-cn/guide/introduce/about.md index efcff23..b937f61 100644 --- a/zh-cn/guide/introduce/about.md +++ b/zh-cn/guide/introduce/about.md @@ -1,3 +1,5 @@ # 关于 Hyperf Fans 欢迎来到 Hyperf Fans,这里是 Hyperf Fans 的官方文档站点。 + + \ No newline at end of file diff --git a/zh-hk/guide/introduce/about.md b/zh-hk/guide/introduce/about.md index d50e6e7..78552fd 100644 --- a/zh-hk/guide/introduce/about.md +++ b/zh-hk/guide/introduce/about.md @@ -1,3 +1,5 @@ # 關於 Hyperf Fans 歡迎來到 Hyperf Fans,這裏是 Hyperf Fans 的官方文檔站點。 + + \ No newline at end of file diff --git a/zh-tw/guide/introduce/about.md b/zh-tw/guide/introduce/about.md index bac5c74..77d39ea 100644 --- a/zh-tw/guide/introduce/about.md +++ b/zh-tw/guide/introduce/about.md @@ -1,3 +1,5 @@ # 關於 Hyperf Fans 歡迎來到 Hyperf Fans,這裡是 Hyperf Fans 的官方文件站點。 + + \ No newline at end of file