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

Rework template translation finding #1197

Merged
merged 1 commit into from
Nov 27, 2023
Merged

Conversation

rowanseymour
Copy link
Member

So that it can work with locales that we get from WhatsApp like en-US using a smart matcher and so we don't have to map those on the RP side and then map them back in courier.

Copy link

codecov bot commented Nov 24, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b00666e) 87.66% compared to head (323786c) 87.64%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1197      +/-   ##
==========================================
- Coverage   87.66%   87.64%   -0.02%     
==========================================
  Files         262      262              
  Lines       10961    10952       -9     
==========================================
- Hits         9609     9599      -10     
- Misses        929      930       +1     
  Partials      423      423              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rowanseymour rowanseymour force-pushed the template_translation_matching branch from f880b5f to 323786c Compare November 24, 2023 19:21
[]string{"Chef"},
"",
"Hello Chef",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this case is a little weird because it's just defaulting to the first translation... but it does seem better to generally return something here than creating a message without a template that probably going to fail.

@norkans7
Copy link
Contributor

the language from WA are like en_GB, es_MX not exactly en-GB and es-MX, so we substitute the underscore with the hyphen somewhere?

@rowanseymour
Copy link
Member Author

@norkans7 yeah I think we can say that locale is always <lang>-<COUNTRY> - and for flows and contacts language is always 3 chars, but for external stuff it might sometimes be only 2-chars.

@rowanseymour rowanseymour merged commit 5ebb751 into main Nov 27, 2023
6 of 7 checks passed
@rowanseymour rowanseymour deleted the template_translation_matching branch November 27, 2023 15:17
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2023
@rowanseymour
Copy link
Member Author

Been thinking about this a bit more I think we when syncing we should store both the original language code, and our current language (3 chars) + country fields on the template translation object. That way the engine can continue to work with xxx or xxx-YY format locales, but in mailroom, when queuing the message to courier, we can lookup the original language code on the translation object, and queue that.

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

Successfully merging this pull request may close these issues.

2 participants