#!perl -w
#
# Tk Transaction Manager.
# Language localization
#
# makarow, demed
#

package Tk::TM::Lang;
require 5.000;
use strict;
require Exporter;

use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
$VERSION = '0.52';
@ISA = qw(Exporter);
@EXPORT = qw();
@EXPORT_OK = qw(txtMenu txtHelp txtMsg);

use vars qw($Lang);
$Lang   ='';      # set localization

1;


sub txtHelp {
my $txt;
$txt =
  ["-------- 'File' - File operations --------"
  ,"'Save', [S], [Shift+F2], [Ctrl+S] - save modified data."
  ,"'Reread', [<>], [F5] - reread data to screen, refresh view. Same as 'Query' but keeps current position."
  ,"'Print...', [Ctrl+P] - print data."
  ,"'Export...' - export data to file shoosen."
  ,"'Import...' - import data from file choosen."
  ,"'Close', [Alt+F4] - close window."
  ,"'Exit', [Shift+F3] - exit application."
  ,"-------- 'Edit' - Editing data --------"
  ,"'New record', [+], [Ctrl+N] - create (append) new record of data."
  ,"'Delete record', [-], [Ctrl+Y] - delete the current record of data."
  ,"'Undo edit' - undo changes made in current record."
  ,"'Prompt...', [F4] - entry help screen to choose value to enter into field."
  ,"'Cut' - cut selected text from field onto clipboard."
  ,"'Copy' - copy selected text from field onto clipboard."
  ,"'Paste' - paste text from clipboard to cursor position."
  ,"'Delete' - delete selected text."
  ,"-------- 'Actions', [..] - Actions of application --------"
  ,"Contains available application actions."
  ,"-------- 'Search' - Search, Query, Navigation --------"
  ,"'Query', [Q] - read data onto screen (query database)."
  ,"'Reread', [F5] - reread data onto screen, see this in 'File' menu above."
  ,"'Clear', [C] - clear current data on screen, new records may be entered."
  ,"'Find...', [F], [Ctrl+F] - find value in current column with regilar expression entered."
  ,"'Find Next', [Ctrl+G], [Ctrl+L] - find next value with serch entered above."
  ,"'Top', [<<], [Ctrl+Home] - go to the first record of data."
  ,"'Previos', [<], [PageUp] - go to the previos page or record of data."
  ,"'Next', [>], [PageDn] - go to the next page or record of data."
  ,"'Bottom', [>>], [Ctrl+End] - go to the last record of data."
  ,"-------- 'Help' - Help on application --------"
  ,"'Help...', [?], [F1] - info on using application."
  ,"'About...' - general info on application."
  ] if !$Lang;

$txt =
  ["-------- 'Ôàéë' - Ôàéëîâûå îïåðàöèè --------"
  ,"'Ñîõðàíèòü', [S], [Shift+F2], [Ctrl+S] - ñîõðàíèòü èçìåíåííûå äàííûå."
  ,"'Ïåðå÷èòàòü', [<>], [F5] - ïåðå÷èòàòü äàííûå íà ýêðàí, îñâåæèòü ýêðàí. Àíàëîãè÷íî 'Query' íî ñîõðàíÿåò òåêóùóþ ïîçèöèþ."
  ,"'Ïå÷àòàòü...', [Ctrl+P] - ïå÷àòàòü äàííûå."
  ,"'Ýêñïîðò...' - ýêñïîðòèðîâàòü äàííûå â âûáðàííûé ôàéë."
  ,"'Èìïîðò...' - èìïîðòèðîâàòü äàííûå èç âûáðàííîãî ôàéëà."
  ,"'Çàêðûòü', [Alt+F4] - çàêðûòü îêíî."
  ,"'Âûõîä', [Shift+F3] - çàâåðøèòü ïðèëîæåíèå."
  ,"-------- 'Ðåäàêòèðîâàòü' - Îïåðàöèè ðåäàêòèðîâàíèÿ --------"
  ,"'Íîâàÿ çàïèñü', [+], [Ctrl+N] - ñîçäàòü (äîáàâèòü) íîâóþ çàïèñü äàííûõ."
  ,"'Óäàëèòü çàïèñü', [-], [Ctrl+Y] - óäàëèòü òåêóùóþ çàïèñü äàííûõ."
  ,"'Îòìåíèòü ðåäàêòèðîâàíèå' - îòìåíèòü èçìåíåíèÿ òåêóùåé çàïèñè."
  ,"'Ïîäñêàçêà...', [F4] - âûçâàòü ýêðàí ïîäñêàçêè çàïîëíåíèÿ òåêóùåãî ïîëÿ."
  ,"'Âûðåçàòü' - âûðåçàòü âûáðàííûé òåêñò èç ïîëÿ â áóôåð îáìåíà."
  ,"'Êîïèðîâàòü' - ñêîïèðîâàòü âûáðàííûé òåêñò èç ïîëÿ â áóôåð îáìåíà."
  ,"'Âñòàâèòü' - âñòàâèòü òåêñò èç áóôåðà îáìåíà â ïîçèöèþ êóðñîðà."
  ,"'Óäàëèòü' - óäàëèòü âûáðàííûé òåêñò."
  ,"-------- 'Äåéñòâèÿ', [..] - Ïðèêëàäíûå äåéñòâèÿ --------"
  ,"Ñîäåðæèò èìåþùèåñÿ ïðèêëàäíûå äåéñòâèÿ."
  ,"-------- 'Ïîèñê' - Ïîèñê, Çàïðîñû, Íàâèãàöèÿ --------"
  ,"'Çàïðîñ', [Q] - ïðî÷èòàòü äàííûå íà ýêðàí (çàïðîñ ê áàçå äàííûõ)."
  ,"'Ïåðå÷èòàòü', [F5] - ïåðå÷èòàòü äàííûå íà ýêðàí, îñâåæèòü ýêðàí. Ñì. òàêæå ìåíþ 'Ôàéë'."
  ,"'Î÷èñòèòü', [C] - óáðàòü òåêóùèå äàííûå ñ ýêðàíà, ìîæíî ñîçäàâàòü íîâûå çàïèñè."
  ,"'Íàéòè...', [F], [Ctrl+F] - íàéòè çíà÷åíèå â òåêóùåì ñòîëáöå, ñîîòâåòñòâóþùåå ââîäèìîìó ðåãóëÿðíîìó âûðàæåíèþ."
  ,"'Íàéòè äàëåå', [Ctrl+G], [Ctrl+L] - íàéòè ñëåäóþùåå çíà÷åíèå â îïèñàííîì âûøå ïîèñêå."
  ,"'Íà÷àëî', [<<], [Ctrl+Home] - ïåðåéòè ê ïåðâîé çàïèñè äàííûõ."
  ,"'Ïðåäûäóùàÿ', [<], [PageUp] - ïåðåéòè ê ïðåäûäóùåé ñòðàíèöå èëè çàïèñè äàííûõ."
  ,"'Ñëåäóþùàÿ', [>], [PageDn] - ïåðåéòè ê ñëåäóþùåé ñòðàíèöå èëè çàïèñè äàííûõ."
  ,"'Ïîñëåäíÿÿ', [>>], [Ctrl+End] - ïåðåéòè ê ïîñëåäíåé çàïèñè äàííûõ."
  ,"-------- 'Ñïðàâêà' - Ïîëó÷åíèå ñïðàâêè --------"
  ,"'Ñïðàâêà...', [?], [F1] - ñâåäåíèÿ îá èñïîëüçîâàíèè ïðèëîæåíèÿ."
  ,"'Î ïðèëîæåíèè...' - îñíîâíûå ñâåäåíèÿ î ïðèëîæåíèè."
  ] if $Lang;

  return($txt)
}


sub txtMenu {
  return(
  ['File','~Save','~Reread','~Print...','~Export...','~Import...','~Close','~Exit'
  ,'Edit','~New record','~Delete record','~Undo record','~Prompt...','~Undo','Cu~t','~Copy','~Paste','De~lete','Select ~All'
  ,'Actions'
  ,'Search','~Query','~Reread','~Clear','Con~dition...','~Find...','Find ~Next','~Top','~Previos','Ne~xt','~Bottom'
  ,'Help','~Help...','~About...'
  ]
  ) if !$Lang;

  return(
  ['Ôàéë','~Ñîõðàíèòü','~Ïåðå÷èòàòü','~Ïå÷àòàòü...','~Ýêñïîðò...','~Èìïîðò...','~Çàêðûòü','~Âûõîä'
  ,'Ðåäàêòèðîâàòü','~Íîâàÿ çàïèñü','~Óäàëèòü çàïèñü','~Îòìåíèòü ðåäàêòèðîâàíèå','~Ïîäñêàçêà...','~Undo','~Âûðåçàòü','~Êîïèðîâàòü','Âñò~àâèòü','~Óäàëèòü','Select ~All'
  ,'Äåéñòâèÿ'
  ,'Ïîèñê','~Çàïðîñ','~Ïåðå÷èòàòü','~Î÷èñòèòü','~Óñëîâèå...','~Íàéòè...','~Íàéòè äàëåå','~Íà÷àëî','~Ïðåäûäóùàÿ','~Ñëåäóþùàÿ','~Ïîñëåäíÿÿ'
  ,'Ñïðàâêà','~Ñïðàâêà...','~Î ïðèëîæåíèè...'
  ]
  ) if $Lang;
}


sub txtMsg {
 return($_[0]) if !$Lang;
 my %msg =(
  'About application' => 'Î ïðèëîæåíèè'
 ,'Cancel' => 'Îòìåíèòü'
 ,'Choose' => 'Âûáðàòü'
 ,'Close' => 'Çàêðûòü'
 ,'Closing' => 'Çàêðûòèå'
 ,'Condition' => 'Óñëîâèå'
 ,'Data was modified' => 'Äàííûå áûëè èçìåíåíû'
 ,'Database' => 'Áàçà äàííûõ'
 ,'Error' => 'Îøèáêà'
 ,'Find' => 'Íàéòè'
 ,'Function not released' => 'Ôóíêöèÿ íå ðåàëèçîâàíà'
 ,'Help' => 'Ñïðàâêà'
 ,'Load data from file' => 'Çàãðóçèòü äàííûå èç ôàéëà'
 ,'Login' => 'Ðåãèñòðàöèÿ'
 ,'Ok' => 'Èñïîëíèòü'
 ,'Opening' => 'Îòêðûòèå'
 ,'Operation' => 'Äåÿòåëüíîñòü'
 ,'Order by' => 'Ñîðòèðîâêà'
 ,'Pardon' => 'Èçâèíèòå'
 ,'Password' => 'Ïàðîëü'
 ,'Save changes?' => 'Ñîõðàíèòü èçìåíåíèÿ?'
 ,'Save data into file' => 'Ñîõðàíèòü äàííûå â ôàéë'
 ,'User' => 'Ïîëüçîâàòåëü'
 ,'Where condition' => 'Óñëîâèå'
 ,'Writing' => 'Çàïèñü'
 );
 return($msg{$_[0]} || $_[0]);
}