MOBILE-4360 lang: Trim custom string values

main
Alfonso Salces 2023-06-12 13:40:18 +02:00
parent d7a18dd36c
commit fec9d13607
2 changed files with 20 additions and 1 deletions

View File

@ -380,7 +380,7 @@ export class CoreLangProvider {
const list: string[] = strings.split(/(?:\r\n|\r|\n)/);
list.forEach((entry: string) => {
const values: string[] = entry.split('|');
const values: string[] = entry.split('|').map(value => value.trim());
if (values.length < 3) {
// Not enough data, ignore the entry.

View File

@ -0,0 +1,19 @@
@app @javascript
Feature: Custom lang strings
Background:
Given the following "users" exist:
| username |
| student1 |
Scenario: Customlangstrings without whitespaces
Given the following config values are set as admin:
| customlangstrings | core.courses.mycourses\|Foo\|en | tool_mobile |
When I entered the app as "student1"
Then I should be able to press "Foo" in the app
Scenario: Customlangstrings with whitespaces
Given the following config values are set as admin:
| customlangstrings | core.courses.mycourses\| Foo with whitespaces \|en | tool_mobile |
When I entered the app as "student1"
Then I should be able to press "Foo with whitespaces" in the app