-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use newlines instead of commas to separate translated aliases (re: #3)
Strip whitespace between search terms
- Loading branch information
1 parent
83e0c22
commit b44adb3
Showing
2 changed files
with
10 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -288,10 +288,10 @@ function generatePresets(dataDir, tstrings, searchableFieldIDs, listReusedIcons) | |
}; | ||
delete preset.name; | ||
|
||
if (preset.aliases) tstrings.presets[id].aliases = preset.aliases.join(','); | ||
if (preset.aliases) tstrings.presets[id].aliases = preset.aliases.map(t => t.trim()).filter(Boolean).join('\n'); | ||
delete preset.aliases; | ||
|
||
tstrings.presets[id].terms = (preset.terms || []).join(','); | ||
tstrings.presets[id].terms = (preset.terms || []).map(t => t.trim()).filter(Boolean).join(','); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
quincylvania
Author
Contributor
|
||
delete preset.terms; | ||
|
||
if (preset.moreFields) { | ||
|
@@ -392,7 +392,11 @@ function generateTranslations(fields, presets, tstrings, searchableFieldIDs) { | |
let keys = Object.keys(tags); | ||
|
||
if (keys.length) { | ||
yamlPreset['name#'] = keys.map(k => `${k}=${tags[k]}`).join(' + ') + ' (translate with one or more comma-separated names)'; | ||
yamlPreset['name#'] = keys.map(k => `${k}=${tags[k]}`).join(' + '); | ||
if (yamlPreset.aliases) { | ||
yamlPreset['name#'] += '\\n\\n' + yamlPreset.aliases.split('\n').join('\\n'); | ||
} | ||
yamlPreset['name#'] += '\\n\\nTranslate the primary name. Optionally, add equivalent synonyms on newlines in order of preference (press the Return key).'; | ||
} | ||
|
||
if (preset.searchable !== false) { | ||
|
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
Wouldn't it be
to also use the newline for terms?
Of course, this requires once to execute some script that replaces all "," with "\n" for all translation files and re-upload them to transifex.
One way or the other, data consumers which parse the translation files will either need to be adapted to split by "\n" instead of ",", or the build process which puts the translation files into
dist
already splits them up and puts them into an array.