Skip to content

Bahasa Indonesia translation #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -18,6 +18,7 @@ Dutch translation by [_Ivo Herweijer_](https://github.com/easydatawarehousing)
Brazilian Portuguese translation by [_Ricardo da Verdade Silva_](https://github.com/ricardovsilva)
Japanese translation by _Koji Shimada_ & _Masayoshi Takahashi_
Russian translation by [_Alexander Nikolaev_](https://github.com/startaper)
Bahasa Indonesia translation by [_Irvan Fauziansyah_](https://github.com/irvanfza)

Suggestions to improve translations are welcome.
If you submit a pull request updating a translation please
Expand Down
1 change: 1 addition & 0 deletions collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def initialize(app, options_hash={}, &block)
Collector.new('translations/pt-br/try_ruby_*.md', 'source/try_ruby_pt-br.json').collect
Collector.new('translations/ja/try_ruby_*.md', 'source/try_ruby_ja.json').collect
Collector.new('translations/ru/try_ruby_*.md', 'source/try_ruby_ru.json').collect
Collector.new('translations/id/try_ruby_*.md', 'source/try_ruby_id.json').collect

# TODO: add any new translations here

Expand Down
1 change: 1 addition & 0 deletions source/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ description: Learn to program in Ruby in 30 minutes
<option value="pt-br">Português do Brasil</option>
<option value="ja">日本語</option>
<option value="ru">Русский</option>
<option value="id">Bahasa Indonesia</option>
</select>
</div>
</div>
Expand Down
58 changes: 58 additions & 0 deletions source/try_ruby_id.json

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions translations/id/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Copyright (C)
Try Ruby version 4 English version, 2014-2015, _Irvan Fauziansyah_

## 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.
26 changes: 26 additions & 0 deletions translations/id/try_ruby_10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
lang: ID
title: Punya waktu 30 menit? Coba Ruby sekarang juga!
answer:
class: stretcher chapmark
ok:
error:
---

Ruby adalah sebuah bahasa pemrograman dari Jepang yang merevolusi
dunia pengembangan software.

Keindahan dari Ruby terletak pada keseimbangan antara kesederhanaan dan kekuatannya.

Kamu bisa coba mengetik beberapa kode Ruby di editor dan gunakan tombol-tombol berikut untuk navigasi:

- __Run__ &rarr; Mengeksekusi kode yang ada di editor
- __Copy__ &rarr; Menyalin contoh kode kedalam editor
- __Next__ &rarr; Melanjutkan ke pelajaran selanjutnya
- __Back__ &rarr; Kembali ke pelajaran sebelumnya
- __Clear__ &rarr; Mengosongkan editor

Gunakan tombol dengan ikon 'dunia' <span aria-hidden="true" class="glyphicon glyphicon-globe"></span>
diatas untuk merubah bahasa TryRuby.

### Klik tombol __Next__ untuk mulai belajar.
15 changes: 15 additions & 0 deletions translations/id/try_ruby_100.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
lang: ID
title: Stop, You're Barking Mad!
answer: ^\d{1,}$
ok: Only strings can be reversed
error:
---

You can't reverse the number forty. I guess you can hold your monitor up to the mirror, but reversing a number just doesn't make sense.

Ruby has tossed an error message. Ruby is telling you there is no method reverse for numbers.

Maybe if you turn the number into a string first:

40.to_s.reverse
22 changes: 22 additions & 0 deletions translations/id/try_ruby_110.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
lang: ID
title: Apples are Different From Oranges
answer: \[\]
ok: Great, that's an empty list
error:
---

And numbers are different from strings.

While you can use methods on any object in Ruby, some methods only work on certain types of things.
But you can always convert between different types using Ruby's "to" methods.

- __to_s__ converts things to __s__trings
- __to_i__ converts things to __i__ntegers (numbers)
- __to_a__ converts things to __a__rrays

__What are arrays?!__

They are lists. Type in a pair of brackets:

[]
18 changes: 18 additions & 0 deletions translations/id/try_ruby_120.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
lang: ID
title: Standing in Line
answer: ^\[([-\.\d]+)(\s*,\s*[-\d\.]+){3,}\]$
ok: Excellent
error: Try adding a fourth number to the list
---

Lists (arrays) store things __in some order__.

Like standing in line for popcorn. You are behind someone and you wouldn't dream of pushing them aside,
right? And the guy behind you, you've got a close eye on him, right?

Here's a list for you. Lottery numbers:

[12, 47, 35]

Try adding a number to this list: type a comma after 35 followed by a number. The space is optional.
13 changes: 13 additions & 0 deletions translations/id/try_ruby_130.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
lang: ID
title: One Raises Its Hand
answer: ^47$
ok: Okay
error:
---

A list of lottery numbers. Which one is the highest?

Try:

[12, 47, 35].max
13 changes: 13 additions & 0 deletions translations/id/try_ruby_140.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
lang: ID
title: Tucking a List Away
answer: ^\[(\d+)(,\s*\d+){2,}\]$
ok: Saved!
error:
---

Good, good. But it's annoying to have to retype that list every time you need it, isn't it?

Let's save our numbers inside a ticket like so:

ticket = [12, 47, 35]
12 changes: 12 additions & 0 deletions translations/id/try_ruby_150.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
lang: ID
title: Now Type Ticket
answer: \[(\d+(, )?){2,}\]
load: ticket = [12, 47, 35]
ok: Restored!
error:
---

Now, type:

ticket
24 changes: 24 additions & 0 deletions translations/id/try_ruby_160.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
lang: ID
title: Saved, Tucked Away
answer: \[12, 35, 47\]
load: ticket = [12, 47, 35]
ok: You've sorted the list
error:
---

You've hung on to your lotto numbers, tucking them away inside a __variable__ called ticket.
But any other name, like _jimmyslist_, would have been fine too.

Programming, you will discover, is mostly about working with variables.

Let's put your lotto numbers in order, how about?

Use:

ticket.sort!

You had a list. You sorted the list. The ticket variable is now changed.
Did you notice that the _sort!_ method has a big, bright exclamation at the end?
A lot of times Ruby methods shout like that if they alter the variable for good.
It's nothin special, just a mark.
34 changes: 34 additions & 0 deletions translations/id/try_ruby_170.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
lang: ID
title: Elemental
answer: ^(12|35|47)$
load: ticket = [12, 47, 35]
ok: Ok
error: Almost
---

So we stored our lotto numbers inside variable ticket. How to get 'em out again?

We already saw that we can get the highest number with __max__. Similarly you can
get the __first__ or the __last__ element of the list.
But what if you want a specific element?

### [ ]
Ruby uses the square brackets [ ] to target an element.
The square brackets are very common in Ruby.
They are like sights used to line up a target. Exactly.
These brackets mean, "I am looking for ____" Ready, aim.

Let's get all of our lotto numbers:

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

Why do we use [0], [1], [2]?

And not [1], [2] and [3]? Is that some kind of Japanese Zen thing?
No, we computer people just like to begin counting from zero. It's not just a Ruby thing,
this _zero based indexing_ is used in most programming languages.

> A little reminder: you can use the __Copy__ button to copy the example code to the editor.
31 changes: 31 additions & 0 deletions translations/id/try_ruby_180.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
lang: ID
title: Summary #2 is Upon Us
answer: \w+
class: stretcher chapmark
load: poem = "My toast has flown from my hand\nAnd my toast has gone to the moon.\nBut when I saw it on television,\nPlanting our flag on Halley's comet,\nMore still did I want to eat it.\n"
ok: Does it rhyme?
error:
---

Now, look how your second minute went:

### Errors
If you try to reverse a number or do anything fishy, Ruby will tell you so.

### Arrays
Arrays are lists for storing things in some order.
We also know how to create array's and get items from array's.

### Variables
Variables save a thing and give it a name. You used the equals sign to do this. Like:
ticket = [14, 37, 18].

### 2/8
In all there are eight sections. You are two-eighths of the way there! This is simple stuff,
don't you think? Good stuff up ahead.

Let's change directions for a moment. I've stuffed a bit of poetry for you in a certain variable.
Take a look. Type:

puts poem
16 changes: 16 additions & 0 deletions translations/id/try_ruby_190.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
lang: ID
title: Sadly, You Hate Toast Poetry
answer: (toast){0}
load: prev
ok: Excellent
error: Still smells like toast to me
---

Look, it's okay. You don't have to like it. Hack it up, be my guest. Instead of toast, go for a
melon or something. Try this to see the new poem:

poem.gsub("toast", "honeydew")

The __gsub__ method is short for global substitute. It replaces all occurences of "toast" with
"honeydew".
19 changes: 19 additions & 0 deletions translations/id/try_ruby_20.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
lang: ID
title: Cara Menggunakan Editor
answer: ^\d{1,}$
ok: Bagus! Kamu baru saja melakukan perhitungan matematika. Lihat bagaimana jawabannya muncul?
error: Ketik 2 + 6 di dalam editor
---

Jendela editor yang paling bawah adalah tempat untuk menulis kode Ruby kamu, tekan tombol __Run__ dan
lihat hasilnya!

Contoh, coba ketik perhitungan matematika. Seperti:

2 + 6

Hasil dari kode program yang kamu ketik akan muncul sendiri di dalam jendela hasil yang ada di paling atas.
Juga akan ada baris informasi yang membberitahukan seberapa baik kamu.

> Sebagai alternatif kamu bisa menekan tombol __Copy__ untuk menyalin contoh kode yang ada ke dalam editor.
12 changes: 12 additions & 0 deletions translations/id/try_ruby_200.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
lang: ID
title: Ready, Aim
answer: ^\n.ti tae ot (.+)
load: prev
ok: Okay, sure. So the whole poem has been turned backwards.
error:
---

Here's a question: what happens when we reverse this whole poem?

poem.reverse
17 changes: 17 additions & 0 deletions translations/id/try_ruby_210.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
lang: ID
title: Too Much Reversal
answer: ^\["More still did (.+)
load: prev
ok: Yes, almost what we want
error:
---

So the whole poem's been turned backwards, letter-by-letter. I really wanted to just reverse the lines though.
Move the last line up to first and the first line down to last.

Backwards, but not __that__ backwards.

Here's how:

poem.lines.reverse
21 changes: 21 additions & 0 deletions translations/id/try_ruby_220.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
lang: ID
title: Ringlets of Chained Methods
answer: ^More still did (.+)
load: prev
ok: Good show, my friend!<br/>The join method took that array of lines and put them together into a string.
error:
---

So what do you see? What happened there? You typed __poem.lines.reverse__ and what happened?

Two things happened. You turned the poem into a list using lines.
Lines decides the way the string is split up and converts it into an Array.

Then, you reversed that list. You had each line. You reversed them. That's it.

Let's tack one more method on the end there:

puts poem.lines.reverse.join

Combining methods like this is called _method chaining_.
30 changes: 30 additions & 0 deletions translations/id/try_ruby_230.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
lang: ID
title: Of All the Summaries, #3 is Here Now
answer: \{\}
class: stretcher chapmark
load: prev
ok: You've made an empty hash!
error:
---

### Exclamations
Methods may have exclamations (and also question marks) in their name.
These are just there to better explain what their function is. No big deal.

### String manipulation
Search and change strings

### Chaining
Chaining methods lets you get a lot more done. Break up a poem, reverse it, reassemble it:
__poem.lines.reverse.join__

At this point, you may want to tinker with the poem a bit more. A complete list of all the String
methods is <a href="http://ruby-doc.org/core/classes/String.html" target="_blank">here</a>.

Go ahead and try a few, such as: poem.downcase or poem.swapcase

## Ready?
When you feel ready to move on, type:

books = {}
Loading