with Ada.Calendar;
with Ada.Containers;
with Ada.Containers.Hashed_Maps;
with Ada.Strings.Unbounded;
with Ada.Text_IO.Editing;
5
with Templates_Parser;

with Bookstore.Books;

10package Bookstore.Messages is
   -- java strings may contain "{0}", which is intended to be replaced by
   --  a parameter. I didn't adapt this yet.

   type Available_Languages is
15     (
      En, -- english
      Fr, -- french
      De  -- german
     );
20
   type Message_Key is
     (Server_Error_Key,    Order_Error_Key,

      Title_Server_Error_Key,  Title_Shopping_Cart_Key,    Title_Receipt_Key,
25      Title_Book_Catalog_Key,  Title_Book_Description_Key, Title_Cashier_Key,

      Book_Catalog_Key,   Shopping_Cart_Key,

      Cart_Removed_Key,   Cart_Cleared_Key,      Cart_Contents_Key,
30      Cart_Items_Key,     Cart_Added_1_Key,      Cart_Added_2_Key,
      Cart_Add_Key,       Cart_Item_Count_Key,   Edit_Cart_Key,
      Remove_Item_Key,    Subtotal_Key,          Clear_Cart_Key,
      Cart_Item_Key,      Cart_Check_Key,        Cart_Empty_Key,

35      Visitor_Key,   What_Key,   Talk_Key,   Start_Key,   Critics_Key,
      Price_Key,

      By_Key,   Buy_Key,   Choose_Key,

40      Item_Quantity_Key,   Item_Title_Key,   Item_Price_Key,

      Checkout_Key,   Amount_Key,     Inventory_Key,   Purchase_Key,
      Name_Key,       CC_Number_Key,  Submit_Key,      Catalog_Key,
      With_Key,       Total_Key,      Continue_Shopping_Key,
45
      Thank_You_Key,   Thank_You_Param_Key,    Thanks_Msg_Key,

      Shipping_Key,    Quick_Ship_Key,   Normal_Ship_Key,   Saver_Ship_Key,
      Ship_Date_Key,   Ship_Date_LC_Key,
50
      Confirm_Add_Key,   Confirm_Remove_Key,

      Newsletters_Key,   Duke_Fan_Club_Key,   Update_Quantities_Key,

55      Quantities_Updated_Key,   Quantities_Key,

      Choose_Locale_Key,   English_Key,   German_Key,   Spanish_Key,
      French_Key,

60      Customer_Info_Key,   Caption_Key
     );

private

65   function Hash_Key (Key : Message_Key) return Ada.Containers.Hash_Type;

   package Maps is new Ada.Containers.Hashed_Maps
     (Key_Type => Message_Key,
      Element_Type    => Ada.Strings.Unbounded.Unbounded_String,
70      Hash     => Hash_Key,    Equivalent_Keys => "=",
      "=" => Ada.Strings.Unbounded."=");

   package Decimal_Output is new Ada.Text_IO.Editing.Decimal_Output
     (Num => Bookstore.Books.Value);
75
end Bookstore.Messages;

top