root/simulator/trunk/src/internationalization/i18n.cmd

Revision 1449, 3.5 kB (checked in by sehenley, 7 months ago)

Clean tabs, line endings - etc.

  • Property svn:keywords set to
    Url
    Rev
    Author
    Date
    Id
Line 
1 echo off
2 rem    traingear -- a network enabled railroad operations simulator and utilities
3 rem    Copyright (C) 2007,2008 Samuel E. Henley sehenley@comcast.net
4 rem
5 rem    This program is free software; you can redistribute it and/or modify
6 rem    it under the terms of the GNU General Public License as published by
7 rem    the Free Software Foundation; either version 2 of the License, or
8 rem    (at your option) any later version.
9 rem
10 rem    This program is distributed in the hope that it will be useful,
11 rem    but WITHOUT ANY WARRANTY; without even the implied warranty of
12 rem    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 rem    GNU General Public License for more details.
14 rem
15 rem    You should have received a copy of the GNU General Public License along
16 rem    with this program; if not, write to the Free Software Foundation, Inc.,
17 rem    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 rem
19 rem
20
21 rem @ \file
22 rem @ Builds the mo files for internationalzation and update source po files.
23 rem @ \note arguments %1=${SIMULATOR_WORKING_BINARY_DIRECTORY}
24 rem @                 %2=${GNU_XGETTEXT_UTILITY}
25 rem @                 %3=${WXWINDOWS_WXRC_UTILITY}
26 rem @                 %4=${SIMULATOR_WORKING_DIRECTORY}
27 rem @
28
29
30 rem @ \page internationalization1 Internationalization
31 rem @ \par Internationalization.
32 rem @ \note The simulator and utilities will use the GNU gettext library to do localization
33 rem @ and internationalization for both windows and linux. The primary
34 rem @ tool used will be poEdit. The build process will contain a job (INTERNATIONALIZATION)
35 rem @ that will gather strings and add then to the source files in the internationalization
36 rem @ sub-directory of src (trunk/src/internationalization).
37 rem @ This file is a combination of wxstd.po and the strings gathered from the utilities.
38 rem @ This po source will install on the user machine with instruction to
39 rem @ get poEdit to facilitate translations.
40 rem @
41
42
43 setlocal enabledelayedexpansion
44
45 if exist %1\internationalization\tmp (
46     rd /s /q %1\internationalization\tmp
47 )
48
49 md %1\internationalization\tmp
50 cd %1\internationalization\tmp
51
52 type nul > cppfiles.txt
53
54 rem @ \note Collect xrc files and produce fake cpp files for xgettext.
55 rem @
56
57 for /R %4\src %%F in (*.xrc) do (
58     %3 --gettext --cpp-code --output=%1\internationalization\tmp\%%~nFstring.cpp %%F
59     echo %1\internationalization\tmp\%%~nFstring.cpp >> cppfiles.txt
60 )
61
62 rem @ \note Collect all cpp files for xgettext.
63 rem @
64 for /R %4\src %%F in (*.cpp) do echo %%F >> cppfiles.txt
65 for /R %4\src %%F in (*.h) do echo %%F >> cppfiles.txt
66
67 rem @ \note Collect all the strings from cpp files using xgettext.
68 rem @
69 %2\xgettext.exe --files-from=cppfiles.txt --directory= --c++ --keyword=_ --output=%1\internationalization\tmp\osrail.pot
70
71 rem @ \note Collect the current source po files and mearge them with the found strings.
72 rem @
73 rem @ \note Move the po files back, po files in the src are the place
74 rem @ to make changes and translations.
75 rem @
76 rem @ \note Create a mo file for each po file, these files are discardable
77 rem @
78
79 for /R %4\src %%F in (??.po) do (
80     %2\msgcat.exe --use-first --output=%1\internationalization\tmp\%%~nF.po %%F osrail.pot
81     copy /y %1\internationalization\tmp\%%~nF.po %%~pF
82     if not exist %1\%%~nF (
83        md %1\%%~nF
84     )
85     %2\msgfmt.exe --output-file=%1\%%~nF\%%~nF.mo %1\internationalization\tmp\%%~nF.po
86 )
87
88 cd ..
89
90 rd /s /q %1\internationalization\tmp
Note: See TracBrowser for help on using the browser.