Skip to content

Commit

Permalink
htmlカテゴリー翻訳着手、オリジナルレシピディレクトリ追加
Browse files Browse the repository at this point in the history
Session, DB, Eloquent, Route追加
  • Loading branch information
ytake committed Sep 3, 2014
1 parent de75ad4 commit 6e2ec06
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 84 deletions.
10 changes: 5 additions & 5 deletions docs/recipes/coreext/html.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Position: 3
マクロで`$this`にはアクセス出来ませんが、以下のメソッドを利用する事ができます:

* `HTML::entities()` - See [[Converting a HTML String to Entities]].
* `HTML::decode()` - See [[Decoding HTML Entities to a String]].
* `HTML::decode()` - See [[HTMLエンティティのデコード]].
* `HTML::script()` - See [[Generating a Link to a Javascript File]].
* `HTML::style()` - See [[Generating a Link to a CSS File]].
* `HTML::image()` - See [[Generating an HTML Image Element]].
Expand All @@ -98,12 +98,12 @@ Position: 3
* `HTML::linkSecureAsset()` - See [[Generating a Secure HTML Link to an Asset]].
* `HTML::linkRoute()` - See [[Generating a HTML Link to a Named Route]].
* `HTML::linkAction()` - See [[Generating a HTML Link to a Controller Action]].
* `HTML::mailto()` - See [[Generating a HTML Link to an Email Address]].
* `HTML::email()` - See [[Obfuscating an Email Address]].
* `HTML::mailto()` - See [[メールアドレスのHTMLリンクを生成する]].
* `HTML::email()` - See [[メールアドレスを難読化]].
* `HTML::ol()` - See [[Generating an Ordered List of Items]].
* `HTML::ul()` - See [[Generating an Unordered List of Items]].
* `HTML::attributes()` - See [[Bulding an HTML Attribute String From an Array]].
* `HTML::obfuscate()` - See [[Obfuscating a String]].
* `HTML::attributes()` - See [[HTMLの属性を配列で作成する]].
* `HTML::obfuscate()` - See [[文字列を難読化]].

マクロから他のマクロをコールする事ができます
{/discussion}
Empty file added docs/recipes/db/.gitkeep
Empty file.
Empty file added docs/recipes/eloquent/.gitkeep
Empty file.
27 changes: 14 additions & 13 deletions docs/recipes/html/attributes.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
---
Title: Bulding an HTML Attribute String From an Array
Title: HTMLの属性を配列で作成する
Topics: html
Code: Form::macro(), HTML::attributes(), HTML::macro()
Id: 196
Position: 16
---

{problem}
You have an associative array of attributes for an HTML element and want to convert it to a string.
HTMLを構成する属性を配列から文字列に変換したい
{/problem}

{solution}
Use the `HTML::attributes()` method.
`HTML::attributes()`メソッドを利用します

{php}
echo HTML::attributes(array('id' => '123', 'class' => 'myclass'));
{/php}
```php
echo \HTML::attributes(['id' => '123', 'class' => 'myclass']);
```

The above will build a string where the keys of the array are the attribute names and the values of the array are the attribute values. The output will be.
配列のキーは属性名、配列の値は属性値となります
出力は次の様になります

{text}
```text
id="123" class="myclass"
{/text}
```
{/solution}

{discussion}
This is useful in HTML or Form macros.
これはHTMLまたはFormマクロに使用されるケースが多いでしょう

It's useful whenever you need to build tag attributes in HTML or even XML.
HTMLあるいはXMLを構築する場合に便利です。

See [[Creating Form Macros]]
and [[Creating HTML Macros]].
[[Formマクロを作成する]]
[[HTMLマクロを作成する]] をご覧ください
{/discussion}
21 changes: 11 additions & 10 deletions docs/recipes/html/decode.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
---
Title: Decoding HTML Entities to a String
Title: HTMLエンティティのデコード
Topics: html
Code: HTML::decode(), HTML::entities()
Id: 182
Position: 2
---

{problem}
You have a string encoded by `HTML::entities()` and want to decode it back to the original string.
`HTML::entities()`でエンコードされた文字列をデコードしたい
{/problem}

{solution}
Use the `HTML::decode()` method.
`HTML::decode()`メソッドを利用します

This is the opposite of `HTML::entities()`. For example.
これは`HTML::entities()`の逆です

{php}
$string HTML::decode('<h1>Hello</h1>');
{/php}
```php
$string = \HTML::decode('<h1>Hello</h1>');
```

In this example `$string` will equal "<h1>Hello</h1>";
`$string` "<h1>Hello</h1>" となります
{/solution}

{discussion}
This method wraps the PHP `html_entity_decode()` function.
このメソッドはPHPの`html_entity_decode()`ラッパー関数です

Specifically it calls `html_entity_decode($value, ENT_QUOTES, 'UTF-8')`. These options compliment the ones passed to `htmlentities()` by the `HTML::entities()` method.
具体的には`html_entity_decode($value, ENT_QUOTES, 'UTF-8')`をコールしています
これらのオプションは`HTML::entities()``htmlentities()`に指定されたものを補完しています
{/discussion}
25 changes: 13 additions & 12 deletions docs/recipes/html/email.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
---
Title: Obfuscating an Email Address
Title: メールアドレスを難読化
Topics: html
Code: HTML::email(), HTML::obfuscate()
Id: 193
Position: 13
---

{problem}
You want to obfuscate an e-mail address to prevent spam-bots from sniffing it.
スパムボットなどに収集されるのを防ぐために電子メールアドレスを難読化したい
{/problem}

{solution}
Use the `HTML::email()` method.
`HTML::email()`メソッドを利用します

This method takes one argument, the email address.
このメソッドで指定するのは、メールアドレスだけです

{php}
$email = HTML::email('me@local.com');
{/php}
```php
$email = \HTML::email('me@local.com');
```

Now `$email` will display correctly in browsers, but it will randomly contain characters that make it hard to read.
`$email`はブラウザでは正しく表示されますが、
読みづらい文字列が含まれる様になります

{html}
```html
Email is <b>&amp;#x6d;e&amp;#x40;l&amp;#111;ca&amp;#x6c;.c&amp;#x6f;m</b>
{/html}
```
{/solution}

{discussion}
This method uses the `HTML::obfuscate()` method to obfuscate the email address.
このメソッドは`HTML::obfuscate()`を利用して難読化されています

See [[Obfuscating a String]].
[[文字列を難読化]] をご覧ください
{/discussion}
58 changes: 28 additions & 30 deletions docs/recipes/html/mailto.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,65 @@
---
Title: Generating a HTML Link to an Email Address
Title: メールアドレスのHTMLリンクを生成する
Topics: html
Code: HTML::mailto(), HTML::obfuscate()
Id: 192
Position: 12
---

{problem}
You want to add a `mailto:` link to your Blade template.
Bladeテンプレートで`mailto:`リンクを追加したい

You want the email address to be obfuscated so that screen scrapers won't easily be able to harvest the email address.
スパムボットやスクリーンスクレイパーなどに収集されにくくする為にも、難読化をしてみましょう
{/problem}

{solution}
Use the `HTML::mailto()` method.
`HTML::mailto()`メソッドを利用します

The first argument to the method is the email address.
第一引数は、メールアドレスを指定します

{html}
{{ HTML::mailto('a@b.c') }}
{/html}
```html
{{HTML::mailto('a@b.c')}}
```

This will create the mailto link and display the email address as the link text. Notice that Laravel automatically and randomly obfuscates the address. But the address will appear correctly in browsers.
mailtoのリンクを作成し、リンクテキストとして電子メールアドレスが表示されます
_注意:Laravelが自動的にランダムでアドレスを難読化します_
これらはブラウザ等では正常に表示されます

{html}
```html
<a href="ma&amp;#105;&amp;#x6c;&amp;#116;o&amp;#58;&amp;#97;&amp;#64; \
&amp;#x62;.&amp;#99;">&amp;#97;&amp;#64;&amp;#x62;.&amp;#99;</a>
{/html}
```

_(Note backslash above is used to continue line for smaller screens.)_
第二引数はリンクテキストの文字列です

If you pass a second argument, that becomes the link text.
```html
{{HTML::mailto('a@b.c', 'Email Me')}}
```

{html}
{{ HTML::mailto('a@b.c', 'Email Me') }}
{/html}
下記の様な文字列が出力されます(ランダムですので実際の難読化は異なります)

That will produce something similar to below (the actual obfuscation will vary).

{html}
```html
<a href="m&amp;#x61;i&amp;#108;&amp;#x74;&amp;#x6f;&amp;#x3a;&amp;#x61; \
&amp;#x40;&amp;#98;&amp;#46;&amp;#x63;">Email Me</a>
{/html}

_(Backslash above is used to continue the line for smaller screens.)_
```


You can pass a third argument as an array of attributes to apply to the anchor tag.
属性を追加する場合は、第三引数に配列を利用します

{html}
```html
{{ HTML::mailto('a@b.c', 'Email Me', array('class' => 'btn')) }}
{/html}
```

Now the anchor has a class attribute.
`class`が追加されます

{html}
```html
<a href="&amp;#109;&amp;#97;&amp;#105;&amp;#108;&amp;#x74;o&amp;#x3a; \
&amp;#97;&amp;#64;b.&amp;#x63;" class="btn">Email Me</a>
{/html}
```
{/solution}

{discussion}
This method uses the `HTML::obfuscate()` method to obfuscate the email address.
このメソッドは`HTML::obfuscate()`を利用してメールアドレスを難読化しています

See [[Obfuscating a String]].
[[文字列を難読化]] をご覧ください
{/discussion}
31 changes: 17 additions & 14 deletions docs/recipes/html/obfuscate.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
---
Title: Obfuscating a String
Title: 文字列を難読化
Topics: html
Code: HTML::obfuscate()
Id: 197
Position: 17
---

{problem}
You want to prevent spam-bots from sniffing a string on your web page.
Webページ上の文字列がスパムボットに収集されるのを防ぎたい。
{/problem}

{solution}
Use the `HTML::obfuscate()` method.
`HTML::obfuscate()`メソッドを利用します

This method randomly replaces characters in a string with HTML entities. This allows the string to appear correctly in web pages, but many screen scrapers will see the string as garbage.
このメソッドは、ランダムにHTMLエンティティを文字列内の文字を置き換えます
この文字列は、ブラウザ等では正しく表示されますが、
多くのスクリーンスクレーパーにはごみとして扱われます

This is used most frequently for email addresses. For example.
電子メールアドレスのために頻繁に利用されるでしょう
たとえば...

{html}
```html
{{-- Blade template --}}
{{ HTML::obfuscate('me@gmail.com') }}
{/html}
{{HTML::obfuscate('me@gmail.com')}}
```

The above would output something similar to below.
下記のように出力されます

{html}
```html
&amp;#x6d;&amp;#x65;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#97;i&amp;#x6c;. \
&amp;#99;&amp;#x6f;&amp;#x6d;
{/html}
```
{/solution}

{discussion}
This is used by both `HTML::email()` and `HTML::mailto()`.
これは`HTML::email()` `HTML::mailto()`の両方で利用しています

Those methods will obfuscate emails. See [[Obfuscating an Email Address]]
and [[Generating a HTML Link to an Email Address]].
これを用いて電子メールを難読化します [[メールアドレスを難読化]]
[[メールアドレスのHTMLリンクを生成する]] をご覧ください
{/discussion}
Empty file added docs/recipes/router/.gitkeep
Empty file.
Empty file added docs/recipes/session/.gitkeep
Empty file.

0 comments on commit 6e2ec06

Please sign in to comment.