Vietnamese Variable Renamer Extension
Tự động đổi tên biến từ tiếng Việt sang tiếng Anh khi bấm F2 trong VSCode.
Tính năng
- 🔄 Tự động dịch: Đổi tên biến tiếng Việt thành tiếng Anh chỉ với một cú nhấn F2
- 🌐 Đa ngôn ngữ: Hỗ trợ JavaScript, TypeScript, Python, Java, C++
- 📚 Từ điển phong phú: Hơn 200 từ/cụm từ lập trình phổ biến
- ⚡ Nhanh chóng: Không cần mạng, chỉ sử dụng regex và AST
- 🎯 Chính xác: Chỉ đổi biến, không động vào string hay comment
Cách cài đặt
- Mở VSCode
- Vào Extensions (Ctrl+Shift+X)
- Tìm kiếm "Vietnamese Variable Renamer"
- Nhấn Install
- Reload VSCode
Cách sử dụng
Phương pháp 1: F2 Rename (Khuyến nghị)
- Đặt con trỏ lên biến tiếng Việt (ví dụ:
kiemTraDauVao
)
- Nhấn F2
- Extension sẽ tự động gợi ý tên tiếng Anh (ví dụ:
validateInput
)
- Nhấn Enter để chấp nhận hoặc chỉnh sửa
Phương pháp 2: Command Palette
- Nhấn Ctrl+Shift+P
- Gõ "Rename Vietnamese Variable to English"
- Chọn từ danh sách gợi ý
Ví dụ
Tiếng Việt |
Tiếng Anh |
kiemTraDauVao |
validateInput |
xuLyDuLieu |
processData |
luuThongTin |
saveInformation |
tinhToanGia |
calculatePrice |
capNhatTrangThai |
updateStatus |
timKiemSanPham |
searchProduct |
xacThucNguoiDung |
authenticateUser |
themMoiDonHang |
addNewOrder |
Ngôn ngữ được hỗ trợ
- ✅ JavaScript
- ✅ TypeScript
- ✅ Python
- ✅ Java
- ✅ C++
Cấu hình
Mở Settings (Ctrl+,) và tìm "Vietnamese Renamer":
vietnameseRenamer.enableAutoSuggest
: Bật/tắt gợi ý tự động (mặc định: true)
Từ điển
Extension sử dụng từ điển cố định với hơn 200 từ/cụm từ lập trình phổ biến:
Động từ lập trình
kiemTra
→ validate
, check
xuLy
→ process
capNhat
→ update
them
→ add
xoa
→ delete
luu
→ save
tai
→ load
Danh từ dữ liệu
dauVao
→ input
dauRa
→ output
duLieu
→ data
thongTin
→ information
ketQua
→ result
Giao diện người dùng
giaoDien
→ interface
trang
→ page
nut
→ button
bang
→ table
form
→ form
Cách hoạt động
- Phát hiện: Extension quét code để tìm biến có ký tự tiếng Việt
- Phân tích: Sử dụng AST để xác định đây là biến (không phải string/comment)
- Dịch thuật: Chia tên biến thành từng từ và tra từ điển
- Gợi ý: Hiển thị tên tiếng Anh trong hộp rename
Troubleshooting
Extension không hoạt động?
- Kiểm tra ngôn ngữ file có được hỗ trợ không
- Đảm bảo biến có chứa ký tự tiếng Việt
- Thử reload VSCode
Không có gợi ý dịch?
- Từ có thể chưa có trong từ điển
- Sử dụng Command Palette để xem tất cả gợi ý
Dịch sai?
- Extension chỉ dịch theo từ điển cố định
- Có thể chỉnh sửa tên sau khi gợi ý
Đóng góp
Nếu bạn muốn thêm từ mới vào từ điển, hãy tạo issue hoặc pull request!
License
MIT License - Sử dụng tự do cho mục đích cá nhân và thương mại.
English Version
Vietnamese Variable Renamer Extension
Automatically rename variables from Vietnamese to English with F2 in VSCode.
Features
- 🔄 Auto Translation: Rename Vietnamese variables to English with just F2
- 🌐 Multi-language: Supports JavaScript, TypeScript, Python, Java, C++
- 📚 Rich Dictionary: 200+ common programming terms
- ⚡ Fast: No internet required, uses regex and AST only
- 🎯 Accurate: Only renames variables, leaves strings and comments untouched
Installation
- Open VSCode
- Go to Extensions (Ctrl+Shift+X)
- Search for "Vietnamese Variable Renamer"
- Click Install
- Reload VSCode
Usage
Method 1: F2 Rename (Recommended)
- Place cursor on Vietnamese variable (e.g.,
kiemTraDauVao
)
- Press F2
- Extension will auto-suggest English name (e.g.,
validateInput
)
- Press Enter to accept or edit
Method 2: Command Palette
- Press Ctrl+Shift+P
- Type "Rename Vietnamese Variable to English"
- Choose from suggestion list
Examples
Vietnamese |
English |
kiemTraDauVao |
validateInput |
xuLyDuLieu |
processData |
luuThongTin |
saveInformation |
tinhToanGia |
calculatePrice |
capNhatTrangThai |
updateStatus |
timKiemSanPham |
searchProduct |
xacThucNguoiDung |
authenticateUser |
themMoiDonHang |
addNewOrder |
Supported Languages
- ✅ JavaScript
- ✅ TypeScript
- ✅ Python
- ✅ Java
- ✅ C++
Configuration
Open Settings (Ctrl+,) and search "Vietnamese Renamer":
vietnameseRenamer.enableAutoSuggest
: Enable/disable auto suggestions (default: true)
Dictionary
Extension uses a fixed dictionary with 200+ common programming terms:
Programming Verbs
kiemTra
→ validate
, check
xuLy
→ process
capNhat
→ update
them
→ add
xoa
→ delete
luu
→ save
tai
→ load
Data Nouns
dauVao
→ input
dauRa
→ output
duLieu
→ data
thongTin
→ information
ketQua
→ result
User Interface
giaoDien
→ interface
trang
→ page
nut
→ button
bang
→ table
form
→ form
How It Works
- Detection: Extension scans code for variables with Vietnamese characters
- Analysis: Uses AST to identify variables (not strings/comments)
- Translation: Splits variable name into words and looks up dictionary
- Suggestion: Shows English name in rename box
Troubleshooting
Extension not working?
- Check if file language is supported
- Ensure variable contains Vietnamese characters
- Try reloading VSCode
No translation suggestions?
- Word might not be in dictionary
- Use Command Palette to see all suggestions
Wrong translation?
- Extension only translates using fixed dictionary
- You can edit the name after suggestion
Contributing
If you want to add new words to the dictionary, please create an issue or pull request!
Support
Nếu extension này hữu ích cho bạn, hãy ủng hộ tác giả nhé! 💝
☕ Buy Me a Coffee

💎 Crypto Support
ETH/USDT: 0x3c22A205088609Cc1813e63eA38F7C96a695A3bc (Metamask)
🏦 Bank Transfer (Vietnam)
Techcombank: 6888828882
Account: Nguyen Hoang Tuan Anh
License
MIT License - Free for personal and commercial use.