Open Scot3004 opened 4 months ago
This is something that i've thought about quite a lot—how to support other languages.
I'd really love to be able to easily have translations available. For the Narrator's log, yes, it really would be as simple as having a different beat
for the perform_as
function, like:
from screenpy import See, Silently, beat
class Ver(See):
@beat("{} ve si {question_to_log} es {resolution_to_log}.")
def perform_as(self, the_actor: Actor) -> None:
Silently(super(Ver, self)).perform_as(the_actor) # might work?
Edit: I just realized this probably wouldn't work very well with the Silently
, because everything inside of this See
would be muted. But without the Silently
, the English text would also be read. It's a bit tricky.
That would allow the Narrator to read the Spanish, as long as you made subclasses for all of the Actions you used. The tests themselves would still be using the English methods, though.
Making the methods be Spanish, too, you might be able to do...
class UnActor(Actor):
llamado = Actor.named
quién_puede = Actor.who_can
# ...
That feels a little strange, but i think it should work!
As i said, i'm very interested in this. If you try one of these approaches, can you share how successful it was?
We might need to do some work to more easily allow translations, like Django's _
function or something. I'll be thinking more about this!
I'm not well versed in other languages but I have thought about multi language support and one aspect we'll likely need to figure out is how to handle grammar issues depending on the language.
The current structure of the screenplay pattern is actor-centric because that's how English has a tendency to flow. Subject -> verbs -> noun. "I go to the market."
Whereas some languages might structure the sentence "To the market, I go."
My hunch is some languages will just end up reading like they ran though google translate; which I'm not sure can be helped.
Spanish can be as well actor centric, but for instance in english we have a passive voice like The windows have been cleaned. https://learnenglish.britishcouncil.org/grammar/english-grammar-reference/active-passive-voice
I'm thinking if there's any possibility to give the actions that are performed in another language for example spanish. Should I write classes with their respective
beat
for the specific lang? For example if I need an actorHow I should implement this
Create a narrator that gets the message in english and process through a .po file dinamically?
Create a class based on each of the classes using custom
@beat
? for example