@@ -52,6 +52,7 @@ struct RuntimeModulesConfig(String, #[serde(default)] Option<String>);
5252#[ serde( rename_all = "camelCase" ) ]
5353pub struct RuntimeModulesConfigMap {
5454 i18n : Option < RuntimeModulesConfig > ,
55+ #[ serde( alias = "Trans" ) ]
5556 trans : Option < RuntimeModulesConfig > ,
5657 use_lingui : Option < RuntimeModulesConfig > ,
5758}
@@ -206,6 +207,37 @@ mod lib_tests {
206207 )
207208 }
208209
210+ #[ test]
211+ fn test_config_capital_trans ( ) {
212+ let config = serde_json:: from_str :: < LinguiJsOptions > (
213+ r#"{
214+ "runtimeModules": {
215+ "Trans": ["@lingui/react", "Trans"]
216+ }
217+ }"# ,
218+ )
219+ . expect ( "invalid config for lingui-plugin" ) ;
220+
221+ assert_eq ! (
222+ config,
223+ LinguiJsOptions {
224+ runtime_modules: Some ( RuntimeModulesConfigMap {
225+ i18n: None ,
226+ trans: Some ( RuntimeModulesConfig (
227+ "@lingui/react" . into( ) ,
228+ Some ( "Trans" . into( ) )
229+ ) ) ,
230+ use_lingui: None ,
231+ } ) ,
232+ descriptor_fields: None ,
233+ use_lingui_v5_id_generation: None ,
234+ id_prefix_leader: None ,
235+ jsx_placeholder_attribute: None ,
236+ jsx_placeholder_defaults: None ,
237+ }
238+ )
239+ }
240+
209241 #[ test]
210242 fn test_config_optional ( ) {
211243 let config = serde_json:: from_str :: < LinguiJsOptions > (
0 commit comments