By GokiSoft.com| 10:12 27/08/2021|
Java Advanced

[Share Code] Lập trình đa ngôn ngữ trong java - Khoá học lập trình java nâng cao

#Main.java


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package java2.lesson09;

import java.util.Locale;
import java.util.ResourceBundle;

/**
 *
 * @author Diep.Tran
 */
public class Main {
    public static void main(String[] args) {
        showMenu();
    }
    
    static void showMenu() {
//        Locale locale = Locale.getDefault();
        Locale locale = new Locale("vi", "VN");
        ResourceBundle bundle = ResourceBundle.getBundle("java2.lesson09.global", locale);
        
        System.out.println(bundle.getString("option_input_student"));
        System.out.println(bundle.getString("option_display_student"));
        System.out.println(bundle.getString("option_exit"));
        System.out.println(bundle.getString("option"));
    }
}


#global.properties


# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.

option_input_student = 1. Input student
option_display_student = 2. Display student
option_exit = 3. Exit
option = Choose: 


#global_vi_VN.properties


# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.

option_input_student = 1. Nhap thong tin sinh vien
option_display_student = 2. Hien thi thong tin sinh vien
option_exit = 3. Thoat
option = Chon: 


Tags:

Phản hồi từ học viên

5

(Dựa trên đánh giá ngày hôm nay)