Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added simple_square_brackets and expand_vowels transforms #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

morwoen
Copy link

@morwoen morwoen commented Jun 22, 2020

Hi, I was tasked with finding a pseudolocalisation library in Python and your project stuck out. Wanted to contribute back some of the extensions we've implemented :)

We've added two new transform functions:

  • simple_square_brackets - add [ and ] around the string to signify the boundaries. Added to allow for more options for boundary characters.
  • expand_vowels - implements the suggestion from the Netflix article https://netflixtechblog.com/pseudo-localization-netflix-12fff76fbcbe Keeps the string easier to read and understand and clear what is part of it and what isn't while still expanding the length.

In terms of backwards compatibility, there should be no issue. Each transform now receives the placeholder/format regex used in order to allow for more complex transforms (such as the expand_vowels which needed to know where all the placeholders are.

@morwoen
Copy link
Author

morwoen commented Jun 25, 2020

Made a small change to the __get_target_length function - if a string contained only placeholders and we discard placeholders in length calculation the size will be 0. This ensures we return 0 as well to account for that.

@robaw
Copy link

robaw commented Aug 7, 2020

Hi @leonidessaguisagjr , would you have interest in accepting this contribution. We'd like to use your tool (and contribute back).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants