By GokiSoft.com| 19:57 29/05/2020|
Java Advanced

[Share Code] Localization - Lập Trình Đa Ngôn Ngữ - Lập Trình Java - Java Advanced

[Share Code] Localization - Lập Trình Đa Ngôn Ngữ - Lập Trình Java - Java Advanced


#general_en_US.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.

menu_input = 1. Input Student's Detail Information
menu_display = 2. Display All Student's Detail Information
menu_sort = 3. Sort
menu_find = 4. Find
menu_exit = 5. Exit
menu_choose = Choose: 


#general.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.

menu_input = 1. Nhap thong tin sinh vien
menu_display = 2. Hien thi danh sach sinh vien
menu_sort = 3. Sap xep
menu_find = 4. Tim kiem
menu_exit = 5. Thoat
menu_choose = Lua chon: 


#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 lession8;

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("en", "US");
        ResourceBundle bundle = ResourceBundle.getBundle("lession8/general", locale);
        
        System.out.println(bundle.getString("menu_input"));
        System.out.println(bundle.getString("menu_display"));
        System.out.println(bundle.getString("menu_sort"));
        System.out.println(bundle.getString("menu_find"));
        System.out.println(bundle.getString("menu_exit"));
        System.out.println(bundle.getString("menu_choose"));
    }
}


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

5

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