feat: add runtime i18n API with manifest translations
This commit is contained in:
@@ -138,6 +138,7 @@ void main() {
|
||||
expect(script.events.map((event) => event.target), ['bad', 'good']);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
RuntimeSession _activeSession() {
|
||||
@@ -177,4 +178,10 @@ class _FakeScriptEngine implements ScriptEngine {
|
||||
}
|
||||
return GameDiff.empty;
|
||||
}
|
||||
|
||||
@override
|
||||
void setTranslations({
|
||||
required String locale,
|
||||
required Map<String, Map<String, String>> translations,
|
||||
}) {}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ void main() {
|
||||
await expectLater(game.callLua('host.ready'), throwsA(isA<StateError>()));
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
class _FakeScriptEngine implements ScriptEngine {
|
||||
@@ -66,6 +67,12 @@ class _FakeScriptEngine implements ScriptEngine {
|
||||
bool smokeTest(Map<String, Object?> context) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
void setTranslations({
|
||||
required String locale,
|
||||
required Map<String, Map<String, String>> translations,
|
||||
}) {}
|
||||
}
|
||||
|
||||
class _FakePackageRepository implements GamePackageRepository {
|
||||
|
||||
@@ -217,6 +217,7 @@ void main() {
|
||||
expect(store.markedPackages, [fallback.rootPath]);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Map<String, Object?> _context(GamePackage package) {
|
||||
@@ -393,6 +394,12 @@ class _FakeScriptEngine implements ScriptEngine {
|
||||
|
||||
@override
|
||||
GameDiff dispatchEvent(RuntimeEvent event) => GameDiff.empty;
|
||||
|
||||
@override
|
||||
void setTranslations({
|
||||
required String locale,
|
||||
required Map<String, Map<String, String>> translations,
|
||||
}) {}
|
||||
}
|
||||
|
||||
const _validScript = '''
|
||||
|
||||
Reference in New Issue
Block a user