Skip to content

Commit

Permalink
add translation to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hekmatinasser committed Jul 15, 2021
1 parent 99044f3 commit 75a9713
Show file tree
Hide file tree
Showing 5 changed files with 209 additions and 22 deletions.
18 changes: 17 additions & 1 deletion docs/en/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,22 @@ <h3>Validation Rules</h3>
0 => "The expire datetime must be a Jalali datetime before 1397/02/16 12:10:00."
]
]
</pre>


<h2 id="traslation">Traslation</h2>
<p>You can show weekdays, months , messages in the languages available in Verta To view supported languages, go to the folder <a href="https://github.com/hekmatinasser/verta/tree/master/src/Lang">langs</a></p>
<p>To set locale, use the following command</p>
<pre>
Verta::setLocale('fa');
</pre>
<p>To get current locale, use the following command</p>
<pre>
Verta::getLocale(); // fa
</pre>
<p>To reset locale to fa, use the following command</p>
<pre>
Verta::resetLocale();
</pre>
</article>
</div>
Expand All @@ -574,7 +590,7 @@ <h3>Validation Rules</h3>

<footer id="footer">
<div style="text-align: center;">
2020 &copy;
2017-2021 &copy;
</div>
</footer>
</body>
Expand Down
53 changes: 34 additions & 19 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ <h2 id="installation">نصب</h2>

<pre>// config/app.php
'providers' => [
...
Hekmatinasser\Verta\Laravel\VertaServiceProvider::class,
...
Hekmatinasser\Verta\Laravel\VertaServiceProvider::class,
],

'alias' => [
...
'Verta' => Hekmatinasser\Verta\Verta::class,
...
'Verta' => Hekmatinasser\Verta\Verta::class,
]</pre>
<h2 id="usage">نحوه استفاده</h2>
<p>در بالای هر فایل خود از کلاس ورتا استفاده میکند، از دستور زیر استفاده کنید</p>
Expand Down Expand Up @@ -415,7 +415,7 @@ <h2 id="comparison">بررسی و مقایسه</h2>
</pre>
<h2 id="validation">اعتبار سنجی</h2>
<p>شما می توانید با اعتبار سنجی لاراول تاریخ های شمسی درون فرم های خود استفاده کنید</p>
<p>شما باید پیام های خطا برای اعتبار سنجی خود در در مسیر فایل های ترجمه خود اضافه کنیدبرای نمونه کد هایی که درون پکیج برای پیام خطا وجود دارد در فایل ترجمه خود قرار دهیدبرای مثال در فایل ترجمه پیام خطا به آرایه عبارات زیر را اضافه کنید</p>
<p>شما باید پیام های خطا برای اعتبار سنجی خود در در مسیر فایل های ترجمه خود اضافه کنید ارور های ترجمه شده برای زبان های قابل پشتیبانی در <a href="https://github.com/hekmatinasser/verta/tree/master/src/Lang">زبان ها</a> مراجعه کنید قرار دارد .برای نمونه کد هایی که درون پکیج برای پیام خطا وجود دارد در فایل ترجمه خود قرار دهیدبرای مثال در فایل ترجمه پیام خطا به آرایه عبارات زیر را اضافه کنید</p>
<pre>
'jdate' => ':attribute تاریخ شمسی معتبر نمی باشد.',
'jdate_equal' => ':attribute تاریخ شمسی برابر :date نمی باشد.',
Expand All @@ -433,8 +433,8 @@ <h2 id="validation">اعتبار سنجی</h2>
'jdatetime_before_equal' => ':attribute تاریخ و زمان شمسی باید قبل یا برابر از :date باشد.',

'attributes' => [
'start_date' => 'تاریخ شروع',
'expire_datetime' => 'تاریخ انقضا',
'start_date' => 'تاریخ شروع',
'expire_datetime' => 'تاریخ انقضا',
],
</pre>
<h3>قوانین اعتبار سنجی</h3>
Expand Down Expand Up @@ -550,12 +550,12 @@ <h3>قوانین اعتبار سنجی</h3>
<p>میتوانید با ترکیب قوانین تاریخ را بین دو محدوده بررسی کنید</p>
<pre>
$validate = Validator::make([
'start_date' => '1389/01/31',
'expire_datetime' => '1397/02/16 12:10:00',
'start_date' => '1389/01/31',
'expire_datetime' => '1397/02/16 12:10:00',
],
[
'start_date' => 'required|jdate:Y/m/d|jdate_after:1388/01/01,Y/m/d|jdate_before:1390/01/01',
'expire_datetime' => 'required|jdatetime|jdatetime_after:1397/02/16 12:09:50,Y/m/d H:i:s|jdatetime_before:1397/02/16 12:11:00',
'start_date' => 'required|jdate:Y/m/d|jdate_after:1388/01/01,Y/m/d|jdate_before:1390/01/01',
'expire_datetime' => 'required|jdatetime|jdatetime_after:1397/02/16 12:09:50,Y/m/d H:i:s|jdatetime_before:1397/02/16 12:11:00',
]);

if ($validate->fails()) {
Expand All @@ -564,16 +564,31 @@ <h3>قوانین اعتبار سنجی</h3>

//output
array:2 [
"start_date" => array:1 [
0 => "تاریخ شروع تاریخ شمسی باید قبل از ۱۳۹۰/۰۱/۰۱ باشد."
]
"expire_datetime" => array:1 [
0 => "تاریخ انقضا تاریخ و زمان شمسی باید قبل از ۱۳۹۷/۰۲/۱۶ ۱۲:۱۰:۰۰ باشد."
]
"start_date" => array:1 [
0 => "تاریخ شروع تاریخ شمسی باید قبل از ۱۳۹۰/۰۱/۰۱ باشد."
]
"expire_datetime" => array:1 [
0 => "تاریخ انقضا تاریخ و زمان شمسی باید قبل از ۱۳۹۷/۰۲/۱۶ ۱۲:۱۰:۰۰ باشد."
]
]
</pre>

<h2 id="validation">اعتبار سنجی</h2>
<h2 id="traslation">زبان ها</h2>
<p>شما میتوانید ایام و ماه ها و پیام را به زبان های موجود در ورتا نمایش دهید برای مشاهده زبان ها پشتیبانی می شود به پوشه زیر مشاهده
<a href="https://github.com/hekmatinasser/verta/tree/master/src/Lang">زبان ها</a> مراجعه کنید</p>
<p>برای تعیین زبان پیام های از دستور زیر استفاده کنید</p>
<pre>
Verta::setLocale('fa');
</pre>
<p>برای دریافت زبان جاری پیام های از دستور زیر استفاده کنید</p>
<pre>
Verta::getLocale(); // fa
</pre>
<p>برای ریست کردن زبان به فارسی از دستور زیر استفاده کنید</p>
<pre>
Verta::resetLocale();
</pre>
<p>برای افزودن زبان های دیگر نمونه فایل های موجود را برای ادغام با پروژه ارسال کنید</p>

</article>
</div>
Expand All @@ -582,7 +597,7 @@ <h2 id="validation">اعتبار سنجی</h2>

<footer id="footer">
<div style="text-align: center;">
2020 &copy;
2017-2021 &copy;
</div>

</footer>
Expand Down
77 changes: 77 additions & 0 deletions src/Lang/az.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

return [
'numbers' => [
'0' => '۰',
'1' => '۱',
'2' => '۲',
'3' => '۳',
'4' => '۴',
'5' => '۵',
'6' => '۶',
'7' => '۷',
'8' => '۸',
'9' => '۹',
],
'year_months' => [
'1' => 'آغلارگولر',
'2' => 'گولن',
'3' => 'قیزاران',
'4' => 'قورا پیشیرن',
'5' => 'قویروق دوغان',
'6' => 'زومار',
'7' => 'خزل',
'8' => 'قیروو',
'9' => 'آذر',
'10' => 'چیلله',
'11' => 'دوندوران',
'12' => 'بایرام',
],
'weekdays' => [
'1' => 'شنبه',
'2' => 'یکشنبه',
'3' => 'دوشنبه',
'4' => 'سه شنبه',
'5' => 'چهارشنبه',
'6' => 'پنج شنبه',
'7' => 'جمعه',
],
'date_units' => [
'second' => 'ثانیه',
'mintue' => 'دقیقه',
'hour' => 'ساعت',
'day' => 'روز',
'week' => 'هفته',
'month' => 'ماه',
'yaer' => 'سال',
'decade' => 'دهه',
'century' => 'قرن'
],
'phrase' => [
'am' => 'ق ظ',
'pm' => 'ب ظ',
'ante_meridiem' => 'قبل از ظهر',
'post_meridiem' => 'بعد از ظهر',
'th' => 'ام',
'ago' => 'قبل',
'now' => 'الان',
'later' => 'بعد',
],
'validation' => [
'jdate' => ':attribute' . ' تاریخ شمسی معتبر نمی باشد.',
'jdate_equal' => ':attribute' . ' تاریخ شمسی برابر ' . ':date' . ' نمی باشد.',
'jdate_not_equal' => ':attribute' . ' تاریخ شمسی نامساوی ' . ':date' . ' نمی باشد.',
'jdatetime' => ':attribute' . ' تاریخ و زمان شمسی معتبر نمی باشد.',
'jdatetime_equal' => ':attribute' . ' تاریخ و زمان شمسی مساوی ' . ':date' . ' نمی باشد.',
'jdatetime_not_equal' => ':attribute' . ' تاریخ و زمان شمسی نامساوی ' . ':date' . ' نمی باشد.',
'jdate_after' => ':attribute' . ' تاریخ شمسی باید بعد از ' . ':date' . ' باشد.',
'jdate_after_equal' => ':attribute' . ' تاریخ شمسی باید بعد یا برابر از ' . ':date' . ' باشد.',
'jdatetime_after' => ':attribute' . ' تاریخ و زمان شمسی باید بعد از ' . ':date' . ' باشد.',
'jdatetime_after_equal' => ':attribute' . ' تاریخ و زمان شمسی باید بعد یا برابر از ' . ':date' . ' باشد.',
'jdate_before' => ':attribute' . ' تاریخ شمسی باید قبل از ' . ':date' . ' باشد.',
'jdate_before_equal' => ':attribute' . ' تاریخ شمسی باید قبل یا برابر از ' . ':date' . ' باشد.',
'jdatetime_before' => ':attribute' . ' تاریخ و زمان شمسی باید قبل از ' . ':date' . ' باشد.',
'jdatetime_before_equal' => ':attribute' . ' تاریخ و زمان شمسی باید قبل یا برابر از ' . ':date' . ' باشد.',
]
];

77 changes: 77 additions & 0 deletions src/Lang/haz.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

return [
'numbers' => [
'0' => '۰',
'1' => '۱',
'2' => '۲',
'3' => '۳',
'4' => '۴',
'5' => '۵',
'6' => '۶',
'7' => '۷',
'8' => '۸',
'9' => '۹',
],
'year_months' => [
'1' => 'اورال',
'2' => 'اید',
'3' => 'بررید',
'4' => 'سرتایستو',
'5' => 'چیله تایستو',
'6' => 'آخیر تایستو',
'7' => 'تخم ریز',
'8' => 'برگ ریز',
'9' => 'چیله زمستو',
'10' => 'بامو',
'11' => 'سیاه بار',
'12' => 'نجیر',
],
'weekdays' => [
'1' => 'شنبه',
'2' => 'یکشنبه',
'3' => 'دوشنبه',
'4' => 'سه شنبه',
'5' => 'چهارشنبه',
'6' => 'پنج شنبه',
'7' => 'جمعه',
],
'date_units' => [
'second' => 'ثانیه',
'mintue' => 'دقیقه',
'hour' => 'ساعت',
'day' => 'روز',
'week' => 'هفته',
'month' => 'ماه',
'yaer' => 'سال',
'decade' => 'دهه',
'century' => 'قرن'
],
'phrase' => [
'am' => 'ق ظ',
'pm' => 'ب ظ',
'ante_meridiem' => 'قبل از ظهر',
'post_meridiem' => 'بعد از ظهر',
'th' => 'ام',
'ago' => 'قبل',
'now' => 'الان',
'later' => 'بعد',
],
'validation' => [
'jdate' => ':attribute' . ' تاریخ شمسی معتبر نمی باشد.',
'jdate_equal' => ':attribute' . ' تاریخ شمسی برابر ' . ':date' . ' نمی باشد.',
'jdate_not_equal' => ':attribute' . ' تاریخ شمسی نامساوی ' . ':date' . ' نمی باشد.',
'jdatetime' => ':attribute' . ' تاریخ و زمان شمسی معتبر نمی باشد.',
'jdatetime_equal' => ':attribute' . ' تاریخ و زمان شمسی مساوی ' . ':date' . ' نمی باشد.',
'jdatetime_not_equal' => ':attribute' . ' تاریخ و زمان شمسی نامساوی ' . ':date' . ' نمی باشد.',
'jdate_after' => ':attribute' . ' تاریخ شمسی باید بعد از ' . ':date' . ' باشد.',
'jdate_after_equal' => ':attribute' . ' تاریخ شمسی باید بعد یا برابر از ' . ':date' . ' باشد.',
'jdatetime_after' => ':attribute' . ' تاریخ و زمان شمسی باید بعد از ' . ':date' . ' باشد.',
'jdatetime_after_equal' => ':attribute' . ' تاریخ و زمان شمسی باید بعد یا برابر از ' . ':date' . ' باشد.',
'jdate_before' => ':attribute' . ' تاریخ شمسی باید قبل از ' . ':date' . ' باشد.',
'jdate_before_equal' => ':attribute' . ' تاریخ شمسی باید قبل یا برابر از ' . ':date' . ' باشد.',
'jdatetime_before' => ':attribute' . ' تاریخ و زمان شمسی باید قبل از ' . ':date' . ' باشد.',
'jdatetime_before_equal' => ':attribute' . ' تاریخ و زمان شمسی باید قبل یا برابر از ' . ':date' . ' باشد.',
]
];

6 changes: 4 additions & 2 deletions src/Traits/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ public static function resetLocale()
*/
public static function setLocale($locale)
{
static::$locale = $locale;
static::loadMessages($locale);
if($messages = static::loadMessages($locale)) {
static::$locale = $locale;
}
return $messages;
}

/**
Expand Down

0 comments on commit 75a9713

Please sign in to comment.