Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash of trans() function called on absent translation key (#793)
Add method get_translation(lang, key) into Config struct that retrieves translated term from parsed configuration or error when either desired language or key is missing. Use the new method in Trans struct implementing global Tera function trans(). Add unit test to cover both happy and error path for translation retrieval in both config and templates crate.
- Loading branch information
1 parent
e77adc5
commit 5aadd3d
Showing
2 changed files
with
80 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters