// MultiLanguage.h: interface for the CMultiLanguage class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MULTILANGUAGE_H__C977DCC3_475A_4D1D_A970_131F1C9E8810__INCLUDED_)
#define AFX_MULTILANGUAGE_H__C977DCC3_475A_4D1D_A970_131F1C9E8810__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <afxcmn.h>

struct stMenuLanguageInfo
{
    CString csDefaultMenuName;
    CString csOtherLanguageMenuName;
};

struct stAvailableLanguage
{
    CString csLanguageName;
    int nLanguageID;
    bool bEnable;
};

struct stMessageLanguageInfo
{
    int nMessageID;
    CString csMessage;
};

struct stMaintMsgLanguageInfo
{
    int nMaintMsgID;
    CString csMaintMessage;
};

#ifdef  BUILD_UTILITYDLL
#define     UTILITYDLL  __declspec(dllexport)
#else
#define     UTILITYDLL  __declspec(dllimport)
#endif

class UTILITYDLL CMultiLanguage
{
public:
    static CString               GetMaintMessageText(int nMsgID);
    static CString               GetMessageText(int nMsgID);
    static stAvailableLanguage * GetAvailableLanguage(int &nTotalLanguage);
// max 50 chars
    static void    ChangeListCtrlColHeader(CListCtrl *lcList, int nCol, CString csText);
    static CString GetMenuMainViewItemText(CString csMenuItemName);

    static CString GetMenuSetupItemText(CString csMenuItemName);
    static CString GetMenuRecipesItemText(CString csMenuItemName);
    static CString GetMenuMaintenanceItemText(CString csMenuItemName);
    static CString GetMenuHelpItemText(CString csMenuItemName);
    static CString GetMenuDatalogItemText(CString csMenuItemName);
    static CString GetMenuAlarmsItemText(CString csMenuItemName);
    static CString GetMenuCommonItemText(CString csMenuItemName);
    static int     GetPageInfoID(CString csPageName);
    static CString GetMenuItemText(CString csPageName, CString csMenuItemName);
    static CString GetMenuJobsItemText(CString csMenuItemName);
    static void    ResetStructureArray();
    static bool    GetPagesDetailInfo();
    static bool    GetPagesInfo();
    static void    LoadLanguage(int nLanguage);
    static void    SetLanguage(int nLanguage = 0);
    static int     GetLanguage();
    CMultiLanguage();
    virtual ~CMultiLanguage();

    static CStringArray                                      m_csaPageName;
    static CArray <stMenuLanguageInfo*, stMenuLanguageInfo*> m_arrayLanguageInfo;
    static CArray <int, int>                                 m_arrayMenuItemCount;

    static int m_nLanguage;

    static stMenuLanguageInfo *m_stMenuLanguageInfo;

    static CArray <stMessageLanguageInfo*, stMessageLanguageInfo*> m_arrayMessageInfo;

    static stMessageLanguageInfo *m_stMessageLanguageInfo;

// this is for Maintenance Messages
    static CArray <stMaintMsgLanguageInfo*, stMaintMsgLanguageInfo*> m_arrayMaintMsgInfo;
    static stMaintMsgLanguageInfo                                   *m_stMaintMsgLanguageInfo;

// enumeration for all the message box messages
    enum
    {
        // for runview class
        STOP_MACHINE_BEFORE_LOGIN,
        ONLY_ENGINEER_CAN_LOGIN_TO_ENGINEERING_MODE,
        ONLY_ENGINEER_CAN_LOGIN_TO_NONSCHEDULED_MODE,
        ONLY_ENGINEER_CAN_LOGIN_TO_SCHEDULED_MODE,

        // for Help About Page
        All_DLL_AND_EXE_VERSION,

        // for LotReportPage class
        NO_SEARCH_OPTION_SELECTED,
        NO_LOT_INFO_FOUND,
        END_DATE_CANNOT_BE_IN_THE_FUTURE,
        START_DATE_CANNOT_BE_LATER_THAN_END_DATE,
        ENTER_LOT_NUMBER,
        SELECT_ITEM_TO_DELETE, // 10
        CONFIRM_TO_DELETE_ITEM,
        RECORD_NOT_FOUND_DELETE_FAIL,
        SELECT_ITEM_TO_VIEW,
        SELECT_ITEMS_FOR_COMBINE_LOT,

        // for DatalogLotHistoryPage class and datalogLotMsgPage class
        CONFIRM_TO_DELETE_LOT,
        FAIL_TO_PRINT_TO_FILE,
        PRINTED_TO,
        SUCCESSFULLY,
        RECORDSET_NOT_FOUND,
        RECORD_NOT_FOUND_DELETE_LOT_FAIL, // 20

        // for datalogpackagePage class
        PACKAGE_RECORD_NOT_FOUND,         // 21

        // for login class
        NO_PASSWORD_FOUND,
        INVALID,
        PASSWORD,

        // for maindoc class
        INITRUN_ERROR,
        INITCTRLRUN_ERROR,
        SELECT_A_MAIN_MODE_TO_RUN,
        MACHINE_CANNOT_RUN_BECAUSE_OF_EMS,
        MACHINE_UNINITIALISE_CONFIRM_INITIALISE,
        SELECT_A_RECIPE_TO_OPERATE_MACHINE,            // 30
        MACHINE_STILL_IN_MAINTENANCE_MODE_PLEASE_WAIT, // 31
        CANNOT_START_CRUNCTRL,
        INIT_INPUT_CONTROLLER_FAILED_CHECK_AND_RESTART,
        INIT_OUTPUT_CONTROLLER_FAILED_CHECK_AND_RESTART,
        INIT_MOTION_CONTROLLER_FAILED_CHECK_AND_RESTART,
        FAIL_TO_UPDATE_PACKAGE_DATA_PLEASE_CHECK_MITPKG_DATABASE,
        MOTOR_SETTING_ERROR,
        INPUT_SETTING_ERROR,
        OUTPUT_SETTING_ERROR,
        RECORD_NOT_FOUND_IN_MODULE_TABLE_IN_MITMC_DATABASE, // 40
        ERROR_MAINTENANCE_MODULE_TO_SEQUENCE_MAPPING_NOT_INIT,

        DURATION_OUT_OF_RANGE,

        // for Alarmpage class
        REMEDY_TOO_LONG_MAX_LENGTH_IS_200_CHARACTERS,
        JAM_MESSAGE_TOO_LONG_MAX_LENGTH_IS_75_CHARACTERS,

        // for ExportImportWizard class
        PLS_SELECT_ITEM_TO_ADD, // 45
        PLS_SELECT_ITEM_TO_REMOVE,
        PACKAGE_ALREADY_INSIDE_CURRENT_DATABASE1,
        PACKAGE_ALREADY_INSIDE_CURRENT_DATABASE2,
        OVER_WRITE,
        SKIP, // 50
        FILE,
        FAIL_TO_BE_CREATED,
        DATABASE_OBJECT_IS_NULL,
        NO_RECORD_FOUND_IN_MITPKG,
        TABLE_PACKAGE_NAME,
        THERE_IS_NOT_ITEM_TO_ADD_IN_SOURCE_LIST,
        FIELD_COUNT_MISMATCH_IN,
        SOURCE_FILE_COUNT_IS,
        TARGET_FILE_COUNT,
        PLS_CHECK_IT, // 60
        COULD_NOT_BE_FOUND_IN,
        MAINTMESSAGE_TABLE_NOT_FOUND_IN_MITMC,
        MAINTMESSAGE_NOT_FOUND_FOR_MESSAGE_ID,

        // for MaintenanceInputRS class
        NO_RECORDS_FOUND_IN_INPUT_TABLE,
        MODULE_AT_INPUT_TABLE_NOT_FOUND_AT_MODULE_TABLE,

        // for MaintenanceOutputRS class
        NO_RECORDS_FOUND_IN_OUTPUT_TABLE,
        MODULE_AT_OUTPUT_TABLE_NOT_FOUND_AT_MODULE_TABLE,
        OUTPUT_PT_NO,
        NOT_FOUND,

        // for MotorPosRS class
        MOTOR_POS_TABLE_NOT_FOUND_IN_MITPKG, // 70
        NO_RECORDS_FOUND_IN_MOTOR_TABLE,
        MODULE_AT_MOTOR_TABLE_NOT_FOUND_AT_MODULE_TABLE,

        // for MtrProfileRS class
        MOTOR_AT_MOTORPROFILE_TABLE_NOT_FOUND_AT_MOTOR_TABLE,
        NO_RECORD_IN_MOTORPROFILE_TABLE,

        // for PackageEdit class
        CHANGE_HAS_BEEN_MADE_DO_YOU_WANT_TO_SAVE,
        FAIL_TO_SAVE_CHANGE,

        // for PageSetupDlg class
        INVALID_LEFT_MARGIN_SETTING,
        INVALID_RIGHT_MARGIN_SETTING,
        INVALID_TOP_MARGIN_SETTING,
        INVALID_BOTTOM_MARGIN_SETTING, // 80

        // for PictureEx class
        FIND_RESOURCE_FAILED,
        LOAD_RESOURCE_FAILED,
        LOCK_RESOURCE_FAILED,
        CAN_NOT_ALLOCATE_ENOUGH_MEMORY,
        IPICTURE_INTERFACE_IS_NOT_SUPPORTED,

        // for PrintToFile class
        FAIL_TO_CREATE_DIRECTORY_D_REPORT,
        FAIL_TO_PRINT_INTO_FILE,

        // for RecipeCopySettingsPage class
        NO_PACKAGE_FOUND,
        PLEASE_SELECT_A_SOURCE_PACKAGE,
        PLEASE_SELECT_A_DESTINATION_PACKAGE, // 90
        COMFIRM_COPY_PACKAGE_SETTING_FROM,
        TO,
        NO_RECORD_FOUND_IN_MITPKG_COPY_SETTING,
        TABLE_PACKAGE_NAME_COPY_SETTING,
        PLEASE_SELECT_A_MODULE_TO_COPY,
        COPY,
        MOTOR_POS_AND_SPEED_SETTING_FROM,
        SOURCE_AND_DESTINATION_PACKAGE_MUST_BE_DIFFERENT,

        // for RecipeManagement class
        NO_FIELD_NAME_DATA_FOUND,
        NO_DATA_FOUND,                         // 100
        NO_FIELD_DATA_FOUND,

        // for RecipeManagementPage class
        A_NEW_ADDED_RECIPE_HAS_NOT_BEEN_SAVED, // 102
        ARE_YOU_SURE_TO_ADD_A_NEW_RECIPE_TO_DATABASE,
        PLS_CREATE_PACKAGE_FIRST,
        CANNOT_DELETE_CURRENT_SELECT_RECIPE,
        ONE_OR_MORE_LOT_INFO_USES_RECIPE,
        NO_FURTHER_REFERENCE_TO_THIS_RECIPE_IS_AVAILABLE_AFTER_DELETE,
        DO_YOU_REALLY_WANT_TO_DELETE,
        ARE_YOU_SURE_TO_DELETE_THIS_RECIPE,
        FROM_DATABASE, // 110
        RECIPE_NAME_CANNOT_BE_SAVE_AS_NEW,
        RECIPE_NAME_CANNOT_BE_EMPTY,
        DUPLICATE_RECIPE_NAME_PLS_RENAME,
        RECIPE_NAME_CANNOT_BE_EMPTY_PLS_CLICK_PACKAGE_NAME_FIELD_TO_SELECT,
        OUTPUT_MODE_CANNOT_BE_EMPTY_PLS_SELECT,
        CANNOT_SAVE_CHANGES_TO_CURRENT_RUNNING_RECIPE,
        ARE_YOU_SURE_TO_SAVE_THIS_RECIPE,
        NO_RECIPE_FOUND,
        RECIPE,
        SETTING_HAS_BEEN_CHANGED_DO_YOU_WANT_TO_SAVE, // 120
        NO_RECIPE_SELECTED,
        CANNOT_SAVE_OR_DELETE_THE_CURRENT_LOADED_RECIPE,
        FAIL_TO_CREATE_DIRECTORY,
        FAIL_TO_WRITE_RECIPE_SETTING_INTO_A_FILE,

        // for SetupLightPage Class
        DO_YOU_REALLY_WANT_TO_SAVE, // 125
        CHANGES_HAVE_BEEN_MADE_DO_YOU_WANT_TO_SAVE,
        CAN_SAVE_CHANGES_MISMATCH_DATA,

        // for SetupPasswordPage Class
        ARE_YOU_SURE_TO_SAVE_PASSWORD_CHANGES, // 128
        NO_PASSWORD_FOUND_CANNOT_UPDATE_PASSWORD,
        INVALID_CURRENT_PASSWORD,              // 130
        NEW_AND_COMFIRM_PASSWORD_ARE_DIFFERENT,
        PLS_SELECT_RECIPE_NAME_AT_LIST_BOX,
        DELETE_RECIPE_TEXT,
        DELETE_RECIPE_CONFIRMATION,
        DELETE_PPID,
        FAIL_TO_DELETE_RECIPE,
        PLS_KEY_IN_THE_DOWNLOAD_DATA_FILE_NAME,
        DOWNLOAD_TEXT,
        FAIL_TO_DOWNLOAD_DATA_FILE,
        DOWNLOAD_DATA_FILE, // 140
        IS_SUCCESSFUL,
        PLS_KEY_IN_THE_DOWNLOAD_RECIPE_NAME,
        DOWNLOAD_RECIPE_TEXT,
        FAIL_TO_DOWNLOAD_RECIPE,
        FAIL_TO_UPDATE_RECIPE_LIST,
        PLS_KEY_IN_THE_UPLOAD_FILE_NAME,
        UPDATE_TEXT,
        FAIL_TO_UPLOAD_DATA_FILE,
        UPLOAD_DATA_FILE,
        UPDATE_FILE_CONFIRMATION, // 150
        UPLOAD_PPID,
        FAIL_TO_UPLOAD_RECIPE,
        PLS_KEY_IN_THE_USER_RECIPE_NAME,
        // ADD_USER_RECIPE_TEXT,
        ADD_USER_RECIPE_CONFIRMATION,
        FAIL_TO_ADD_USER_RECIPE,
        DO_YOU_WANT_TO_LOAD_GOLDEN_PACKAGE_INFO,

        // For CMainDoc
        FAIL_TO_OPEN, // 157
        FILE_TEXT,
        ERROR_FAIL_TO_INITIALIZE_WINSOCK,
        ERROR_TEXT,   // 160
        FAIL_TO_GET_LOCAL_HOST_NAME,
        FAIL_TO_GET_LOCAL_IP_ADDRESS,
        SECSGEM_IS_NOT_COMMUNICATING_WITH_HOST_OR_DISABLED,
        SECSGEM_IS_NOT_RUNNING_OR_DISCONNECTED,

        // For Cmainfrm class
        CAN_NOT_DISPLAY_PAGE, // 165
        UNAUTHORIZED_USER_PLS_LOGIN_AS_HIGHER_LVL,
        MODULE_NOT_SET_UP_YET,
        NO_RECIPE_RECORD_PLS_CLICK_RECIPES_F3_BTN_TO_CREATE_NEW,
        PLS_EXIT_TO_MAIN_CONTROL_PAGE_TO_RUN_MACHINE,
        PLS_STOP_MACHINE_BEFORE_TERMINATE_APPLICATION,
        ONLY_ENGINEER_CAN_TERMINATE_APPLICATION,
        LOT_IS_OPENED_DO_YOU_REALLY_WANT_TO_TERMINATE_APPLICATION,
        ARE_YOU_SURE_TO_TERMINATE_APPLICATION,

        // For Cmaintenancepag class
        PLS_SELECT_A_POSITION, // 174
        SPEED_SETTING_PERCENTAGE_MUST_BE_FROM,
        THE_POSITION_OFFSET_MUST_BE_WITHIN_TOLERENCE_FROM,
        ARE_YOU_SURE_YOU_WANT_TO_SAVE_THE_MOTOR_SPEED_ACCELERATION,
        ARE_YOU_SURE_YOU_WANT_TO_SAVE_THE_MOTOR_POSITION_ACCELERATION,
        ARE_YOU_SURE_YOU_WANT_TO_SAVE_THE_MOTOR_SPEED_ACCELERATION_TO_GOLDEN_PACKAGE,
        ARE_YOU_SURE_YOU_WANT_TO_SAVE_THE_MOTOR_POSITION_ACCELERATION_TO_GOLDEN_PACKAGE,
        NO_RECORD_FOUND_IN_MOTORPOS_TABLE_IN_MITPKG,
        NO_RECORD_FOUND_IN,
        TABLE_IN_MITPKG,
        NO_RECORD_FOUND_IN_MOTORSPEED_TABLE_IN_MITPKG,             // 184

        // For CRecipePackagePage class
        CANNOT_PERFORM_REQUESTED_OPERATION_DUPLICATE_PACKAGE_NAME, // 185
        PLS_SELECT_A_PACKAGE_TO_EDIT,
        SORRY_DEFAULT_PACKAGE_ONLY_CAN_BE_EDIT_BY_SEVICE,
        CANNOT_DELETE_CURRENT_RUNNING_PACKAGE,
        CANNOT_DELETE_PACKAGE_USED_IN_ONE_OR_MORE_RECIPE,
        CANNOT_DELETE_DEFAULT_PACKAGE,
        DO_YOU_REALLY_WANT_TO_DELETE_PACKAGE,
        NO_RECIPE_PACKAGE_FOUND,
        NO_PACKAGE_FOUND_DELETE_OPERATION_FAILED,
        NO_RECORD_FOUND_FOR,
        IN_MITPKG_MOTORSPEED_TABLE,
        PACKAGE_INFO_RECORD_IS_MISSING,
        MOTOR_SPEED_RECORD_IS_MISSING,
        MOTOR_POSITION_RECORD_IS_MISSING,
        PLS_UPDATE_THE_DATABASE,
        PLS_CHECK_UP_THE_DATABASE,
        PLS_ENTER_A_NEW_PACKAGE_NAME,
        PLS_SELECT_A_PACKAGE,
        CANNOT_RENAME_CURRENT_RUNNING_PACKAGE,
        IS_USED_IN_SOME_RECIPE_RENAMING_WILL_CHANGE_AFFECTED_RECIPE,
        SOME_LOT_INFO_USES_THIS,
        NO_FURURE_REFERENCE_TO_THIS_PACKAGE_IS_AVAILABLE_AFTER_RENAME,
        CANNOT_RENAME_DAFAULT_PACKAGE,
        PACKAGE_NOT_FOUND_RENAME_FAILED,
        NO_RECORD_FOUND_IN_MITPKG_MOTORPOS_TABLE_PACKAGE_NAME,
        PLS_SELECT_A_PACKAGE_TO_DELETE,

        // For setupsecsgempage class
        CLEAR_DISPLAY, // 211
        ARE_YOU_SURE_YOU_WANT_TO_DISABLE_SECSGEM_LIMK,
        GW_SECSGEM_APPLICATION_ARE_NOT_INSTALLED,
        FAIL_TO_CONNECT_TO_SECSGEM_APPLICATION_CHECK_IP,
        ARE_YOU_SURE_YOU_WANT_TO_DISCONNECT_SECSGEM_LIMK,
        SECSGEM_APPLICATION_FAIL,
        SECSGEM_APPLICATION_FAIL_IP_ADDRESS_NOT_CORRECT,
        ARE_YOU_SURE_YOU_WANT_TO_CLOSE_SECSGEM_LIMK,
        FAIL_TO_CLOSE_TI_SECSGEM_PLS_CHECK_AND_CLOSE_IT_MANUALLY,
        SECSGEM_IS_DISABLED_PLS_PRESS_ON_START_SECSGEM_BUTTON,

        // For Gridctrl class
        OLE_INITIALIZATION_FAILED_MAKE_SURE_THAT_OLE_LIBRARIES_CORRECT,

        // For Utility
        THIS_VARIABLE, // 222
        IS_NOT_READ_FROM_FILE_DATA_NOT_UPDATE,
        TABLE,
        IS_ALREADY_GOT,
        FIELD,
        COULD_NOT_FIND_FIELD,
        IN_TABLE,
        STORAGE_STRUCTURE_IS_EMPTY,

        ADD_USER_RECIPE_TEXT, // 230

        TECHINICAN_AND_ABOVE_CAN_DEL_LOT_REPORT,
    };

private:
    static bool    GetMaintMessageInfo();
    static bool    GetMessageInfo();
    static CString GetMenuText(CString csPageName, CString csMenuItemName);

    static bool m_bLanguageLoaded;

    static CMutex m_mutexLanguage;

    static int m_nMessageBoxMsgCount;

    static int m_nMaintMsgCount;

    static CString m_csErrorMsg;
};

#endif // !defined(AFX_MULTILANGUAGE_H__C977DCC3_475A_4D1D_A970_131F1C9E8810__INCLUDED_)
