วิธีการกำหนด Locale ภาษาไทย ให้กับ Ubunutu 8.04

หลังจากที่เรา install Ubuntu 8.04 และลง package ต่าง ๆ ที่เกี่ยวข้องกับภาษาไทยเรียบร้อยแล้ว การใช้งานภาษาไทยก็ยังจะไม่สมบูรณ์ ยกตัวอย่างเช่น nautilus จะไม่สามารถเรียงลำดับชื่อไฟล์ที่เป็นภาษาไทยได้ถูกต้อง วิธีการแก้ไขก็คือเราต้องกำหนดค่า Locale ที่ใช้ให้เป็นภาษาไทยด้วย ซึ่งมีวิธีการดังนี้:

ขั้นแรกเราต้องสร้าง Locale ภาษาไทยก่อนด้วยคำสั่งต่อไปนี้

$ sudo locale-gen th_TH.utf8

หลังจากนั้นตรวจสอบว่าผลการสร้าง Locale เสร็จสมบูรณ์โดยเรียกคำสั่งต่อไปนี้

$ locale -a

ซึ่งเป็นการแสดงรายชื่อ Locale ทั้งหมดที่มีอยู่ในระบบ และผลลัพธ์ที่ได้จากคำสั่งดังกล่าวควรจะมีคำว่า th_TH.utf-8 ดังนี้:

C en_AU.utf8 en_BW.utf8 en_CA.utf8 en_DK.utf8 en_GB.utf8 en_HK.utf8 en_IE.utf8 en_IN en_NZ.utf8 en_PH.utf8 en_SG.utf8 en_US.utf8 en_ZA.utf8 en_ZW.utf8 POSIX th_TH.utf8

หลังจากนั้นเราก็แก้ไขให้ตัวแปรระบบเลือกใช้ Locale ของภาษาไทยในการทำงานโดยแก้ไขไฟล์ /etc/environment และ /etc/default/locale โดยเติมบรรทัดต่อไปนี้เข้าไปทั้งสองไฟล์

LANGUAGE="en_US:en" LANG="th_TH.UTF-8" LC_TIME="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8"

แล้วก็ restart เครื่อง แค่นี้ก็เป็นอันเสร็จเรียบร้อย

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><img> <object> <embed> <param>
  • Lines and paragraphs break automatically.
  • Images can be added to this post.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.
ญาณรักข์ วรรณสาย