When including a file, start looking for the file in any sub-language dir
- Dominant language
- Rust
- Stars
- 114
- Forks
- 85
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 42
Description
When looking for "base" files such as `ClearSpeak_Rules.yaml`, `unicode.yaml`, and `navigation.yaml`, MathCAT will look in a regional dialect subdir first if one is given (e.g., "en-gb"). However, that isn't currently true for included files.
I ran into a use case for using the regional file. There are [special cases for speech for some hyperbolic trig functions in British English](https://nsoiffer.github.io/mathml-docs/intent-core-concepts/#hyperbolic-tangent1function). These are in the middle of `SharedRules/general.yaml`. When that file is included, it would be helpful to first look at `gb/SharedRules/general.yaml` for those regional variants, and then have it include `../SharedRules/general.yaml`.
The current code in speech.rs is
```
let mut included_files = read_new_file(new_file.as_path())?;
```
Probably a new public function in prefs.rs should be added that looks looks in the regional variant first for that file and returns that, otherwise it returns `new_file`. To find the file, it would strip off Language dir base so that `.../en/SharedRules/general.yaml` becomes just `SharedRules/general.yaml` and then we'd look for `gb/SharedRules/general.yaml` relative to `.../en`.
Note: this specific use case might get moved to changing a definition in `definitions.yaml` as per #347. So the fix also needs to deal with overriding or perhaps amending specific definitions. Perhaps a "!" syntax option such as "!OperatorIntentRenaming" means "this _is_ the definition" as opposed to a default that means "this appends to the definitions" would be useful.
One other thing: adding new Unicode or rule definitions for a regional variant triggers a warning about multiple occurrences of the same name/rule. The warning shouldn't be given for these instances.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.