Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
40d2cf5
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
f39a362
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
71a1a1c
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
2d95fd6
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
2efadba
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
064e906
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
2bf5e21
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
79ba268
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
f099674
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
0f51856
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
879fa9b
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
4cf533e
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
1f852f8
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
451246f
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
0c8d6fc
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
3e21c85
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
48e4857
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
02d3db5
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
d17427d
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
813262e
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
76118b3
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
8f396e9
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
ac614d9
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
724ee5f
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
589eb53
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
51dda1b
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
4bb8d14
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
4b2fe26
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
0fd71dd
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
efa71bd
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
e3f8dbc
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
795e440
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
b43e107
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
48b5966
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
446991e
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
199d899
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
435fe6c
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
bd217b9
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
0a5370a
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
659c6db
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
60d86aa
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
a1ebc38
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
ef28ac3
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
6bd0b30
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
de5977d
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
0f69f39
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
15abf99
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
d88b25a
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
385310b
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
9dc32c3
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
a58699a
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
7e156fe
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
3ac87c4
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
623855e
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
3acf02c
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
89a47a0
docs(i18n): add Persian translations
Goudarz Dec 27, 2025
b0a0dae
docs(license): add copyright notice for Persian translation
Goudarz Dec 27, 2025
1fffc2e
docs: add Persian translator credit
Goudarz Dec 27, 2025
365365a
docs: add Persian translator credit
Goudarz Dec 27, 2025
a6ef9f5
feat(i18n): add Persian(fa-IR) language
Goudarz Dec 27, 2025
d8ce144
feat(i18n): add Persian(fa-IR) language
Goudarz Dec 27, 2025
f7c0675
feat(i18n): add Persian(fa-IR) language
Goudarz Dec 27, 2025
4b28b73
docs: add Persian translator credit
Goudarz Dec 27, 2025
026feb1
style(css): add RTL styles for Persian (fa-IR)
Goudarz Dec 27, 2025
4a6aefb
style(css): support RTL layout for Persian playground iframe
Goudarz Dec 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Macedonian translation by [_Violeta Pavleska_](https://github.com/violeta-p)
Chinese translation by [_Ye Junzhe_](https://github.com/McF4r) & [_Bitfox_](https://github.com/bitfoxtop) & [_Heng Li_](https://github.com/iheng)
Turkish translation by [_Ali Rıza Şahin_](https://github.com/ARS-coding)
French translation by [_Olivier Lacan_](https://github.com/olivierlacan) & [_Idris TAKERBOUST_](https://github.com/idrista)
Persian translation by [_Goudarz Jafari_](https://github.com/Goudarz)

Suggestions to improve translations are welcome.
If you submit a pull request updating a translation please
Expand Down
2 changes: 2 additions & 0 deletions app/try_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ def get_language
language = 'tr'
when 'fr'
language = 'fr'
when 'fa-IR', 'fa'
language = 'fa-IR'
else
language = 'en'
end
Expand Down
1 change: 1 addition & 0 deletions collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def initialize(app, options_hash={}, &block)
Collector.new('translations/de/try_ruby_*.md', 'source/try_ruby_de.json').collect
Collector.new('translations/tr/try_ruby_*.md', 'source/try_ruby_tr.json').collect
Collector.new('translations/fr/try_ruby_*.md', 'source/try_ruby_fr.json').collect
Collector.new('translations/fa-IR/try_ruby_*.md', 'source/try_ruby_fa-IR.json').collect
# TODO: add any new translations here

true
Expand Down
1 change: 1 addition & 0 deletions source/about.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Macedonian translation by _Violeta Pavleska_
Chinese translation by _Ye Junzhe_ & _Heng Li_ & _Bitfox_
Turkish translation by _Ali Rıza Şahin_
French translation by _Olivier Lacan_ & _Idris TAKERBOUST_
Persian translation by _Goudarz Jafari_


### Privacy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ I had to make some alterations to the TryRuby lesson content. Also updated some
- Removed mousehole stuff
- Improved the feedback given to the user based on the program's output a bit
- Added support for lesson content in multiple languages. The Spanish, Brazilian Portuguese,
Japanese, Russian, Ukrainian, Macedonian, Dutch, Turkish and French translations are available.
Japanese, Russian, Ukrainian, Macedonian, Dutch, Turkish, French and Persian translations are available.
__If YOU would like to add a translation to TryRuby you are most welcome !__
- Added explanation of if/else statements
- Changed the subject of the "Class" tutorials from building a blog (so last decade) to making an
Expand Down
7 changes: 7 additions & 0 deletions source/layouts/_navbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@
>
Français (fr)
</button>
<button
class="dropdown-item"
data-change-lang="fa-IR"
aria-controls="tryruby-content"
>
فارسی (fa)
</button>
</div>
</li>
</ul>
Expand Down
34 changes: 34 additions & 0 deletions source/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ blockquote {
border-left: .5rem solid var(--secondary-color);
background: transparent;

:lang(fa-IR) & {
border-left: unset;
border-right: .5rem solid var(--secondary-color);
}

& > :last-child {
margin-bottom: 0;
}
Expand Down Expand Up @@ -211,6 +216,10 @@ code,
.CodeMirror pre {
color: #555;
font: .9rem "Source Code Pro", "Courier New", monospace;

:lang(fa-IR) & {
direction: ltr;
}
}

code {
Expand All @@ -224,6 +233,12 @@ pre {
border-left: .5rem solid var(--primary-color);
background: var(--code-light-background-color);

:lang(fa-IR) & {
border-left: unset;
border-right: .5rem solid var(--primary-color);
background: var(--code-light-background-color);
}

code {
padding: 0;
background: transparent;
Expand Down Expand Up @@ -312,5 +327,24 @@ pre {
zoom: .8;
transform: scale(.8);
transform-origin: 0 0;

:lang(fa-IR) & {
transform-origin: top right;
}
}
}

html:lang(fa-IR) body {
direction: rtl;
text-align: right;
}


.dropdown-menu-end[data-bs-popper]:lang(fa-IR) {
left: 0;
right: auto;
}

.form-select:lang(fa-IR) {
background-position: left .75rem center;
}
21 changes: 21 additions & 0 deletions translations/fa-IR/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Copyright (C)
Try Ruby version 4 Persian version, 2025, _Goudarz Jafari_

## The MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
21 changes: 21 additions & 0 deletions translations/fa-IR/try_ruby_10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
lang: FA-IR
title: ۳۰ دقیقه وقت داری؟ همین حالا به روبی یک فرصت بده!
answer:
class: stretcher chapmark
ok:
error:
---

روبی یک زبان برنامه‌نویسی از کشور ژاپن است که در حال متحول‌کردن توسعه نرم‌افزار می‌باشد.

زیبایی روبی در تعادل آن میان سادگی و قدرت یافت می‌شود.

می‌توانید مقداری کد روبی را در ویرایشگر تایپ کنید و از این دکمه‌ها برای پیمایش استفاده کنید:

- __اجرا__ &larr; کد موجود در ویرایشگر را اجرا می‌کند
- __رونوشت__ &larr; کد نمونه را در ویرایشگر رونوشت می‌کند
- __بعدی__ &larr; به شما اجازه می‌دهد به درس بعدی بروید
- __قبلی__ &larr; به شما اجازه می‌دهد به درس قبلی بازگردید

<div class="foxes">روی <strong>بعدی</strong> کلیک کنید تا یادگیری را آغاز کنید.</div>
15 changes: 15 additions & 0 deletions translations/fa-IR/try_ruby_100.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
lang: FA-IR
title: بس کن، دیوانه شدی!
answer: ^\d{1,}$
ok: فقط رشته‌ها می‌توانند وارونه شوند
error:
---

نمی‌توانید عدد چهل را وارونه کنید. حدس می‌زنم بتوانید مانیتور خود را جلوی آینه بگیرید، اما وارونه کردن یک عدد اصلا منطقی نیست.

روبی یک پیام خطا داده است. روبی به شما می‌گوید هیچ متد reverse برای اعداد وجود ندارد.

شاید اگر ابتدا عدد را به رشته تبدیل کنید:

40.to_s.reverse
22 changes: 22 additions & 0 deletions translations/fa-IR/try_ruby_110.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
lang: FA-IR
title: سیب‌ها با پرتقال‌ها فرق دارند
answer: \[\]
ok: عالیه، این یک لیست خالی است
error:
---

و اعداد با رشته‌ها متفاوت هستند.

در حالی که می‌توانید از متدها روی هر شی در روبی استفاده کنید، برخی متدها فقط روی انواع خاصی کار می‌کنند.
اما همیشه می‌توانید بین انواع مختلف با استفاده از متدهای "to" در روبی تبدیل کنید.

- __to_s__ چیزها را به __رشته__ تبدیل می‌کند
- __to_i__ چیزها را به __عدد صحیح__ (اعداد) تبدیل می‌کند
- __to_a__ چیزها را به __آرایه__ تبدیل می‌کند

__آرایه‌ها چی هستند؟!__

آن‌ها لیست هستند. یک جفت براکت تایپ کنید:

[]
18 changes: 18 additions & 0 deletions translations/fa-IR/try_ruby_120.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
lang: FA-IR
title: ایستادن در صف
answer: ^\[([-\.\d]+)(\s*,\s*[-\d\.]+){3,}\]$
ok: عالی
error: سعی کن یک عدد چهارم هم به لیست اضافه کنی
---

لیست‌ها (آرایه‌ها) چیزها را __به ترتیب مشخصی__ ذخیره می‌کنند.

مثل ایستادن در صف نانوایی. شما پشت سر کسی هستید و هرگز فکر نمی‌کنید او را کنار بزنید و ازش رد بشید،
درسته؟ و فردی پشت سر شما، نگاه دقیقی به او دارید، درسته؟

اینجا یک لیست برای شماست. شماره‌های بخت‌آزمایی:

[12, 47, 35]

سعی کنید یک عدد به این لیست اضافه کنید: بعد از 35 یک ویرگول انگلیسی«,» تایپ کنید و سپس یک عدد بنویسید، فاصله اختیاری است.
13 changes: 13 additions & 0 deletions translations/fa-IR/try_ruby_130.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
lang: FA-IR
title: یکی دستش را بالا می‌برد
answer: ^47$
ok: خوبه
error:
---

یک لیست از شماره‌های بخت‌آزمایی. کدام یکی بزرگ‌تر است؟

امتحان کن:

[12, 47, 35].max
13 changes: 13 additions & 0 deletions translations/fa-IR/try_ruby_140.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
lang: FA-IR
title: کنار گذاشتن یک لیست
answer: ^\[(\d+)(,\s*\d+){2,}\]$
ok: ذخیره شد!
error:
---

خوب، خوب؛ اما آزاردهنده است که هر بار که به آن لیست نیاز دارید مجبور باشید دوباره آن را تایپ کنید، این‌طور نیست؟

بیایید اعدادمان را داخل یک بلیت ذخیره کنیم مانند این:

ticket = [12, 47, 35]
12 changes: 12 additions & 0 deletions translations/fa-IR/try_ruby_150.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
lang: FA-IR
title: حالا بلیت را تایپ کن
answer: \[(\d+(, )?){2,}\]
load: ticket = [12, 47, 35]
ok: بازیابی شد!
error:
---

حالا تایپ کن:

ticket
24 changes: 24 additions & 0 deletions translations/fa-IR/try_ruby_160.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
lang: FA
title: ذخیره شد، کنار گذاشته شد
answer: \[12, 35, 47\]
load: ticket = [12, 47, 35]
ok: لیست را مرتب کرده‌ای
error:
---

شما شماره‌های بخت‌آزمایی‌تان را نگه داشته‌اید و آن‌ها را داخل یک **متغیر** به نام ticket کنار گذاشته‌اید.
اما هر نام دیگری، مثل _goudilist_، هم خوب بود.

متوجه خواهید شد که برنامه نویسی بیشتر در مورد کار با متغیرها است.

بیایید شماره‌های بخت‌آزمایی‌تان را مرتب کنیم، چطوره؟

استفاده کنید:

ticket.sort!

شما یک لیست داشتید و اون را مرتب کردید. متغیر ticket اکنون تغییر کرده است.
متوجه شدید که متد _<span dir="ltr">sort!</span>_ با یک علامت تعجب بزرگ در انتها دارد؟
خیلی وقت‌ها متدهای روبی این‌طور فریاد می‌زنند اگر قرار باشد متغیر را برای همیشه تغییر دهند.
چیز خاصی نیست، فقط یک نشانه است.
34 changes: 34 additions & 0 deletions translations/fa-IR/try_ruby_170.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
lang: FA-IR
title: عنصر
answer: ^(12|35|47)$
load: ticket = [12, 47, 35]
ok: خوبه
error: تقریبا
---

پس ما شماره‌های بخت‌آزمایی‌مان را داخل متغیر ticket ذخیره کردیم. چطور دوباره آن‌ها را بیرون بیاوریم؟

قبلاً دیدیم که می‌توانیم بزرگ‌ترین عدد را با __max__ بگیریم. به‌طور مشابه می‌توانید
اولین یا آخرین عنصر لیست را بگیرید.
اما اگر بخواهید یک عنصر مشخص را بگیرید چه؟

### [ ]
روبی از کروشه‌ها [ ] برای هدف‌گیری یک عنصر استفاده می‌کند.
کروشه‌ها در روبی بسیار رایج هستند.
آن‌ها مثل نشانه‌گیری برای هدف هستند. دقیقاً،
این کروشه‌ها یعنی: «من دنبال ____ هستم» آماده، هدف.

بیایید همهٔ شماره‌های بخت‌آزمایی‌مان را بگیریم:

puts ticket[0]
puts ticket[1]
puts ticket[2]

چرا از [0]، [1]، [2] استفاده می‌کنیم؟

و نه [1]، [2] و [3]؟ آیا این نوعی ذِن ژاپنی است؟
نه، ما آدم‌های رایانه‌ای فقط دوست داریم شمارش را از صفر شروع کنیم. این فقط مربوط به روبی نیست،
این _ایندکس‌گذاری از صفر_ در بیشتر زبان‌های برنامه‌نویسی استفاده می‌شود.

> یک یادآوری کوچک: می‌توانید از دکمهٔ __Copy__ برای رونوشت کردن کد نمونه در ویرایشگر استفاده کنید.
31 changes: 31 additions & 0 deletions translations/fa-IR/try_ruby_180.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
lang: FA-IR
title: خلاصهٔ شماره ۲ فرا رسیده است
answer: \w+
class: stretcher chapmark
load: poem = "نان تُستم تا ماه پر کشید،\nاما وقتی از قاب تلویزیون دیدمش،\nکه روی دُمِ دنباله‌دارِ هالی\nپرچم‌مان را می‌کارد،\nدلم بیشتر خواست همان جا\nیک لقمه از آن بزنم!\n"
ok: قافیه داشت؟
error:
---

حالا ببینید دومین دقیقه‌تان چگونه گذشت:

### خطاها
اگر سعی کنید یک عدد را وارونه کنید یا کاری مشکوک انجام دهید، روبی به شما خواهد گفت.

### آرایه‌ها
آرایه‌ها لیست‌هایی برای ذخیرهٔ چیزها به ترتیب مشخص هستند.
ما همچنین می‌دانیم چگونه آرایه‌ها را بسازیم و آیتم‌ها را از آن‌ها بگیریم.

### متغیرها
متغیرها چیزی را ذخیره می‌کنند و به آن نام می‌دهند. شما از علامت مساوی برای این کار استفاده کردید. مانند:
ticket = [14, 37, 18].

### ۲٫۸
در مجموع هشت بخش وجود دارد. شما دو هشتم راه را آمدید! این چیزهای ساده‌ای هستند،
فکر نمی‌کنید؟ چیزهای خوبی در پیش است.

بیایید برای لحظه‌ای جهت را تغییر دهیم. من کمی شعر برایتان داخل یک متغیر گذاشته‌ام.
نگاهی بیندازید. تایپ کنید:

puts poem
15 changes: 15 additions & 0 deletions translations/fa-IR/try_ruby_190.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
lang: FA
title: متاسفانه، از شعر نان تست خوشتان نیامد
answer: (toast){0}
load: prev
ok: عالی
error: هنوز برای من بوی نان تست می‌دهد
---

ببین، اشکالی ندارد. لازم نیست آن را دوست داشته باشی. آن را دستکاری کن، اختیار با توست. به‌جای نان تست، برو سراغ یک خربزه یا چیزی شبیه آن. این را امتحان کن تا شعر جدید را ببینی:

poem.gsub("نان تُستم", "طالبیِ شیرینم")

متد **gsub** کوتاه‌شدهٔ global substitute است. این متد همهٔ موارد «نان تُستم» را با
«طالبیِ شیرینم» جایگزین می‌کند.
18 changes: 18 additions & 0 deletions translations/fa-IR/try_ruby_20.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
lang: FA-IR
title: استفاده از ویرایشگر
answer: ^\d{1,}$
ok: خوبه! کمی ریاضی انجام دادی. ببین چطور پاسخ ظاهر شد؟
error: در ویرایشگر ۲ + ۶ را تایپ کن
---

پنجرهٔ ویرایشگر جایی است که کد روبی خود را تایپ می‌کنید. دکمهٔ __اجرا__ را بزنید و ببینید چطور اجرا می‌شود!

برای مثال، امتحان کنید کمی ریاضی تایپ کنید. مانند:

2 + 6

خروجی برنامهٔ شما باید در پنجرهٔ خروجی نمایش داده شود.
همچنین خط دیگری هم وجود دارد در جواب که به شما می‌گوید چقدر خوب عمل کردید.

> یا می توانید دکمه __رونوشت__ را فشار دهید تا کد نمونه را در ویرایشگر رونوشت شود.
Loading