<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ไอเอินบล๊อก &#187; label</title>
	<atom:link href="http://www.iearn.in.th/tag/label/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.iearn.in.th</link>
	<description>Just Play and Just Knowledge</description>
	<lastBuildDate>Fri, 05 Aug 2011 15:10:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Use I18N with Label</title>
		<link>http://www.iearn.in.th/2009/05/23/use-i18n-with-label/</link>
		<comments>http://www.iearn.in.th/2009/05/23/use-i18n-with-label/#comments</comments>
		<pubDate>Sat, 23 May 2009 16:49:56 +0000</pubDate>
		<dc:creator>nolifelover</dc:creator>
				<category><![CDATA[RoR]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[internationalization on rails]]></category>
		<category><![CDATA[label]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails muti lang]]></category>
		<category><![CDATA[rails tutorails]]></category>
		<category><![CDATA[start with rails]]></category>

		<guid isPermaLink="false">http://www.iearn.in.th/?p=501</guid>
		<description><![CDATA[ช่วงนี้เขียนเรื่อง i18n บ่อยเลยเอา plugins ที่ช่วยให้การทำงานกับ i18n ง่ายขึ้นเมื่อเราใช้ label สำหรับการแสดงชื่อ column ในฐานข้อมูลทำให้เมื่อ gennerate scaffold มาเราไม่จำเป็นต้องแก้อะไร หากเราได้ทำการแปลโมเดลโดยการใช้ i18n core ของ ror ไว้แล้วสามารถที่ใช้งานได้เลย plugins ที่นำเสนอชื่อว่า i18n_label ครับเมื่อเราลง plugins ตัวนี้แล้วจะทำให้ view ทำการเรียกการแปลโมเดลนั้นให้เองเลยอะ สำหรับหากว่าใครต้องการรายละเอียดอื่นๆ สามารถดูได้ที่ http://github.com/iain/i18n_label/tree/master สำหรับการใช้งานเราสามารถใช้งาน label ธรรมดาได้เลยครับ &#38;lt;% form_for&#40;@txaction&#41; do &#124;f&#124; %&#38;gt; &#38;lt;%= f.error_messages %&#38;gt; &#38;lt;%= f.label :code %&#38;gt; &#38;lt;== ส่วนนี้จะแสดงเป็น ชื่อที่ถูกแปลของโมเดลครับ &#38;lt;%= f.text_field :code %&#38;gt; &#38;lt;%= f.label [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.iearn.in.th/wp-content/uploads/2009/05/i18n-label.jpg"><img class="aligncenter size-medium wp-image-502" title="i18n-label" src="http://www.iearn.in.th/wp-content/uploads/2009/05/i18n-label-300x64.jpg" alt="i18n-label" width="300" height="64" /></a><br />
ช่วงนี้เขียนเรื่อง i18n บ่อยเลยเอา plugins ที่ช่วยให้การทำงานกับ i18n ง่ายขึ้นเมื่อเราใช้ label สำหรับการแสดงชื่อ column ในฐานข้อมูลทำให้เมื่อ gennerate scaffold มาเราไม่จำเป็นต้องแก้อะไร หากเราได้ทำการแปลโมเดลโดยการใช้ i18n core ของ ror ไว้แล้วสามารถที่ใช้งานได้เลย<span id="more-501"></span><br />
plugins ที่นำเสนอชื่อว่า i18n_label ครับเมื่อเราลง plugins ตัวนี้แล้วจะทำให้ view ทำการเรียกการแปลโมเดลนั้นให้เองเลยอะ สำหรับหากว่าใครต้องการรายละเอียดอื่นๆ สามารถดูได้ที่ <a href="http://github.com/iain/i18n_label/tree/master">http://github.com/iain/i18n_label/tree/master</a> สำหรับการใช้งานเราสามารถใช้งาน label ธรรมดาได้เลยครับ</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&amp;</span>lt;<span style="color:#006600; font-weight:bold;">%</span> <span style="color:#5A0A0A; font-weight:bold;">form_for</span><span style="color:#006600; font-weight:bold;">&#40;</span>@txaction<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>f<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#006600; font-weight:bold;">%&amp;</span>gt;
    <span style="color:#006600; font-weight:bold;">&amp;</span>lt;<span style="color:#006600; font-weight:bold;">%</span>= f.<span style="color:#9900CC;">error_messages</span> <span style="color:#006600; font-weight:bold;">%&amp;</span>gt;
    <span style="color:#006600; font-weight:bold;">&amp;</span>lt;<span style="color:#006600; font-weight:bold;">%</span>= f.<span style="color:#9900CC;">label</span> <span style="color:#ff3333; font-weight:bold;">:code</span> <span style="color:#006600; font-weight:bold;">%&amp;</span>gt; <span style="color:#006600; font-weight:bold;">&amp;</span>lt;== ส่วนนี้จะแสดงเป็น ชื่อที่ถูกแปลของโมเดลครับ
    <span style="color:#006600; font-weight:bold;">&amp;</span>lt;<span style="color:#006600; font-weight:bold;">%</span>= f.<span style="color:#9900CC;">text_field</span> <span style="color:#ff3333; font-weight:bold;">:code</span> <span style="color:#006600; font-weight:bold;">%&amp;</span>gt;
    <span style="color:#006600; font-weight:bold;">&amp;</span>lt;<span style="color:#006600; font-weight:bold;">%</span>= f.<span style="color:#9900CC;">label</span> <span style="color:#ff3333; font-weight:bold;">:customer_code</span> <span style="color:#006600; font-weight:bold;">%&amp;</span>gt;</pre></div></div>

<p>ส่วนโค้ดด้านล่างคือตัวอย่างของการแปล active record ครับ</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">th:
  activerecord:
    txaction: การทำรายการ
    attributes:
      txaction:
        code: รหัส
        customer_code: รหัสลูกค้า</pre></div></div>


<p class="sayac_bilgi">7 views</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iearn.in.th/2009/05/23/use-i18n-with-label/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

