mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-30 12:50:51 +00:00
HADESCH: Use separate file for translations
This commit is contained in:
parent
0d39e96f55
commit
b8a5483047
@ -374,6 +374,9 @@ endif
|
||||
ifdef ENABLE_DRASCULA
|
||||
DIST_FILES_ENGINEDATA+=drascula.dat
|
||||
endif
|
||||
ifdef ENABLE_HADESCH
|
||||
DIST_FILES_ENGINEDATA+=hadesch_translations.dat
|
||||
endif
|
||||
ifdef ENABLE_HUGO
|
||||
DIST_FILES_ENGINEDATA+=hugo.dat
|
||||
endif
|
||||
|
@ -64,6 +64,7 @@
|
||||
"..\..\..\..\dists\engine-data\drascula.dat"-"c:\data\scummvm\drascula.dat"
|
||||
"..\..\..\..\dists\engine-data\encoding.dat"-"c:\system\apps\scummvm\encoding.dat"
|
||||
"..\..\..\..\dists\engine-data\fonts.dat"-"c:\data\scummvm\fonts.dat"
|
||||
"..\..\..\..\dists\engine-data\hadesch_translations.dat"-"c:\data\scummvm\hadesch_translations.dat"
|
||||
"..\..\..\..\dists\engine-data\hugo.dat"-"c:\data\scummvm\hugo.dat"
|
||||
"..\..\..\..\dists\engine-data\kyra.dat"-"c:\data\scummvm\kyra.dat"
|
||||
"..\..\..\..\dists\engine-data\lure.dat"-"c:\data\scummvm\lure.dat"
|
||||
|
@ -69,6 +69,7 @@
|
||||
"..\..\..\..\dists\engine-data\drascula.dat"-"c:\data\scummvm\drascula.dat"
|
||||
"..\..\..\..\dists\engine-data\encoding.dat"-"c:\data\scummvm\encoding.dat"
|
||||
"..\..\..\..\dists\engine-data\fonts.dat"-"c:\data\scummvm\fonts.dat"
|
||||
"..\..\..\..\dists\engine-data\hadesch_translations.dat"-"c:\data\scummvm\hadesch_translations.dat"
|
||||
"..\..\..\..\dists\engine-data\hugo.dat"-"c:\data\scummvm\hugo.dat"
|
||||
"..\..\..\..\dists\engine-data\kyra.dat"-"c:\data\scummvm\kyra.dat"
|
||||
"..\..\..\..\dists\engine-data\lure.dat"-"c:\data\scummvm\lure.dat"
|
||||
|
@ -62,6 +62,7 @@
|
||||
"..\..\..\..\dists\engine-data\drascula.dat"-"c:\shared\scummvm\drascula.dat"
|
||||
"..\..\..\..\dists\engine-data\encoding.dat"-"c:\shared\scummvm\encoding.dat"
|
||||
"..\..\..\..\dists\engine-data\fonts.dat"-"c:\shared\scummvm\fonts.dat"
|
||||
"..\..\..\..\dists\engine-data\hadesch_translations.dat"-"c:\shared\scummvm\hadesch_translations.dat"
|
||||
"..\..\..\..\dists\engine-data\hugo.dat"-"c:\shared\scummvm\hugo.dat"
|
||||
"..\..\..\..\dists\engine-data\kyra.dat"-"c:\shared\scummvm\kyra.dat"
|
||||
"..\..\..\..\dists\engine-data\lure.dat"-"c:\shared\scummvm\lure.dat"
|
||||
|
@ -70,6 +70,7 @@
|
||||
"..\..\..\..\dists\engine-data\drascula.dat"-"c:\shared\scummvm\drascula.dat"
|
||||
"..\..\..\..\dists\engine-data\encoding.dat"-"c:\shared\scummvm\encoding.dat"
|
||||
"..\..\..\..\dists\engine-data\fonts.dat"-"c:\shared\scummvm\fonts.dat"
|
||||
"..\..\..\..\dists\engine-data\hadesch_translations.dat"-"c:\shared\scummvm\hadesch_translations.dat"
|
||||
"..\..\..\..\dists\engine-data\hugo.dat"-"c:\shared\scummvm\hugo.dat"
|
||||
"..\..\..\..\dists\engine-data\kyra.dat"-"c:\shared\scummvm\kyra.dat"
|
||||
"..\..\..\..\dists\engine-data\lure.dat"-"c:\shared\scummvm\lure.dat"
|
||||
|
@ -824,6 +824,7 @@ XcodeProvider::ValueList& XcodeProvider::getResourceFiles() const {
|
||||
files.push_back("dists/engine-data/drascula.dat");
|
||||
files.push_back("dists/engine-data/encoding.dat");
|
||||
files.push_back("dists/engine-data/fonts.dat");
|
||||
files.push_back("dists/engine-data/hadesch_translations.dat");
|
||||
files.push_back("dists/engine-data/hugo.dat");
|
||||
files.push_back("dists/engine-data/kyra.dat");
|
||||
files.push_back("dists/engine-data/lure.dat");
|
||||
|
@ -58,6 +58,9 @@ cryomni3d.dat FILE "dists/engine-data/cryomni3d.dat"
|
||||
#if PLUGIN_ENABLED_STATIC(DRASCULA)
|
||||
drascula.dat FILE "dists/engine-data/drascula.dat"
|
||||
#endif
|
||||
#if PLUGIN_ENABLED_STATIC(HADESCH)
|
||||
hadesch_translations.dat FILE "dists/engine-data/hadesch_translations.dat"
|
||||
#endif
|
||||
#if PLUGIN_ENABLED_STATIC(HUGO)
|
||||
hugo.dat FILE "dists/engine-data/hugo.dat"
|
||||
#endif
|
||||
|
@ -101,6 +101,10 @@ HadeschEngine::~HadeschEngine() {
|
||||
delete _macCursors[i];
|
||||
_macCursors[i] = nullptr;
|
||||
}
|
||||
|
||||
#ifdef USE_TRANSLATION
|
||||
delete _transMan;
|
||||
#endif
|
||||
}
|
||||
|
||||
void HadeschEngine::setVideoRoom(Common::SharedPtr<VideoRoom> room,
|
||||
@ -461,9 +465,22 @@ void HadeschEngine::exitOptions() {
|
||||
_sceneVideoRoom->unpause();
|
||||
}
|
||||
|
||||
Common::U32String HadeschEngine::translate(const Common::String &str) {
|
||||
#ifdef USE_TRANSLATION
|
||||
return _transMan->getTranslation(str);
|
||||
#else
|
||||
return str.decode();
|
||||
#endif
|
||||
}
|
||||
|
||||
Common::Error HadeschEngine::run() {
|
||||
debug("HadeschEngine::run");
|
||||
|
||||
#ifdef USE_TRANSLATION
|
||||
_transMan = new Common::TranslationManager("hadesch_translations.dat");
|
||||
_transMan->setLanguage(TransMan.getCurrentLanguage());
|
||||
#endif
|
||||
|
||||
const Common::FSNode gameDataDir(ConfMan.get("path"));
|
||||
SearchMan.addSubDirectoryMatching(gameDataDir, "WIN9x");
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "hadesch/event.h"
|
||||
#include "hadesch/herobelt.h"
|
||||
#include "hadesch/persistent.h"
|
||||
#include "common/translation.h"
|
||||
|
||||
struct ADGameDescription;
|
||||
|
||||
@ -176,6 +177,7 @@ public:
|
||||
int genSubtitleID();
|
||||
uint32 getSubtitleDelayPerChar() const;
|
||||
void wrapSubtitles(const Common::U32String &str, Common::Array<Common::U32String> &lines);
|
||||
Common::U32String translate(const Common::String &str);
|
||||
|
||||
private:
|
||||
void addTimer(EventHandlerWrapper event, int32 start_time, int period,
|
||||
@ -225,6 +227,10 @@ private:
|
||||
int _subtitleID;
|
||||
int _subtitleDelayPerChar;
|
||||
|
||||
#ifdef USE_TRANSLATION
|
||||
Common::TranslationManager *_transMan;
|
||||
#endif
|
||||
|
||||
// For freeing purposes
|
||||
Common::Array <Graphics::MacCursor *> _macCursors;
|
||||
Common::Array <Graphics::WinCursorGroup *> _winCursors;
|
||||
|
@ -52,3 +52,55 @@ endif
|
||||
|
||||
# Include common rules
|
||||
include $(srcdir)/rules.mk
|
||||
|
||||
ifneq "$(HADESCH_RULES_INCLUDED)" "1"
|
||||
|
||||
HADESCH_RULES_INCLUDED := 1
|
||||
HADESCH_POTFILE := $(srcdir)/engines/hadesch/po/hadesch.pot
|
||||
HADESCH_POFILES := $(wildcard $(srcdir)/engines/hadesch/po/*.po)
|
||||
|
||||
hadesch-updatepot:
|
||||
cat $(srcdir)/engines/hadesch/po/POTFILES_hadesch | \
|
||||
xgettext -f - -D $(srcdir) -d hadesch --c++ -k_ -k_s -k_c:1,2c -k_sc:1,2c -kTranscribedSound:2 --add-comments=I18N\
|
||||
-kDECLARE_TRANSLATION_ADDITIONAL_CONTEXT:1,2c -o $(HADESCH_POTFILE) \
|
||||
--copyright-holder="ScummVM Team" --package-name=ScummVM \
|
||||
--package-version=$(VERSION) --msgid-bugs-address=scummvm-devel@lists.scummvm.org -o $(HADESCH_POTFILE)_
|
||||
|
||||
sed -e 's/SOME DESCRIPTIVE TITLE/LANGUAGE translation for ScummVM/' \
|
||||
-e 's/UTF-8/CHARSET/' -e 's/PACKAGE/ScummVM/' $(HADESCH_POTFILE)_ > $(HADESCH_POTFILE).new
|
||||
|
||||
rm $(HADESCH_POTFILE)_
|
||||
if test -f $(HADESCH_POTFILE); then \
|
||||
sed -f $(srcdir)/po/remove-potcdate.sed < $(HADESCH_POTFILE) > $(HADESCH_POTFILE).1 && \
|
||||
sed -f $(srcdir)/po/remove-potcdate.sed < $(HADESCH_POTFILE).new > $(HADESCH_POTFILE).2 && \
|
||||
if cmp $(HADESCH_POTFILE).1 $(HADESCH_POTFILE).2 >/dev/null 2>&1; then \
|
||||
rm -f $(HADESCH_POTFILE).new; \
|
||||
else \
|
||||
rm -f $(HADESCH_POTFILE) && \
|
||||
mv -f $(HADESCH_POTFILE).new $(HADESCH_POTFILE); \
|
||||
fi; \
|
||||
rm -f $(HADESCH_POTFILE).1 $(HADESCH_POTFILE).2; \
|
||||
else \
|
||||
mv -f $(HADESCH_POTFILE).new $(HADESCH_POTFILE); \
|
||||
fi;
|
||||
|
||||
engines/hadesch/po/%.po: $(HADESCH_POTFILE)
|
||||
msgmerge $@ $(HADESCH_POTFILE) -o $@.new
|
||||
if cmp $@ $@.new >/dev/null 2>&1; then \
|
||||
rm -f $@.new; \
|
||||
else \
|
||||
mv -f $@.new $@; \
|
||||
fi;
|
||||
|
||||
hadesch-translations-dat: devtools/create_translations
|
||||
devtools/create_translations/create_translations hadesch_translations.dat $(HADESCH_POFILES)
|
||||
mv hadesch_translations.dat $(srcdir)/dists/engine-data/hadesch_translations.dat
|
||||
|
||||
update-hadesch-translations: hadesch-updatepot $(HADESCH_POFILES) hadesch-translations-dat
|
||||
|
||||
update-hadesch-translations: hadesch-updatepot $(HADESCH_POFILES)
|
||||
@$(foreach file, $(HADESCH_POFILES), echo -n $(notdir $(basename $(file)))": ";msgfmt --statistic $(file);)
|
||||
@rm -f messages.mo
|
||||
|
||||
.PHONY: updatehadeschpot hadesch-translations-dat update-hadesch-translations
|
||||
endif # HADESCH_RULES_INCLUDED
|
||||
|
@ -1097,7 +1097,7 @@ void VideoRoom::playSubtitles(const char *text, int subID) {
|
||||
int delay = g_vm->getSubtitleDelayPerChar();
|
||||
if (delay <= 0)
|
||||
return;
|
||||
Common::U32String s = _(text);
|
||||
Common::U32String s = g_vm->translate(text);
|
||||
Common::Array<Common::U32String> lines;
|
||||
int32 countTime = g_vm->getCurrentTime();
|
||||
g_vm->wrapSubtitles(s, lines);
|
||||
|
Loading…
Reference in New Issue
Block a user