@@ -1099,6 +1099,8 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
1099
1099
if (!$ this ->isConfigEnabled ($ container , $ config )) {
1100
1100
$ container ->removeDefinition ('console.command.translation_debug ' );
1101
1101
$ container ->removeDefinition ('console.command.translation_update ' );
1102
+ $ container ->removeDefinition ('console.command.translation_pull ' );
1103
+ $ container ->removeDefinition ('console.command.translation_push ' );
1102
1104
1103
1105
return ;
1104
1106
}
@@ -1165,6 +1167,42 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
1165
1167
$ container ->getDefinition ('console.command.translation_update ' )->replaceArgument (6 , $ transPaths );
1166
1168
}
1167
1169
1170
+ if (!empty ($ config ['remotes ' ])) {
1171
+ if (empty ($ config ['enabled_locales ' ])) {
1172
+ throw new LogicException ('You must specify framework.translator.enabled_locales in order to use remotes. ' );
1173
+ }
1174
+
1175
+ if ($ container ->hasDefinition ('console.command.translation_pull ' )) {
1176
+ $ container ->getDefinition ('console.command.translation_pull ' )
1177
+ ->replaceArgument (5 , $ transPaths )
1178
+ ->replaceArgument (6 , $ config ['enabled_locales ' ])
1179
+ ;
1180
+ }
1181
+
1182
+ if ($ container ->hasDefinition ('console.command.translation_push ' )) {
1183
+ $ container ->getDefinition ('console.command.translation_push ' )
1184
+ ->replaceArgument (3 , $ transPaths )
1185
+ ->replaceArgument (4 , $ config ['enabled_locales ' ])
1186
+ ;
1187
+ }
1188
+
1189
+ $ container ->getDefinition ('translation.remotes_factory ' )
1190
+ ->replaceArgument (1 , $ config ['enabled_locales ' ])
1191
+ ;
1192
+
1193
+ $ container ->getDefinition ('translation.remotes ' )->setArgument (0 , $ config ['remotes ' ]);
1194
+
1195
+ $ classToServices = [
1196
+ LocoRemoteFactory::class => 'translation.remote_factory.loco ' ,
1197
+ ];
1198
+
1199
+ foreach ($ classToServices as $ class => $ service ) {
1200
+ if (!class_exists ($ class )) {
1201
+ $ container ->removeDefinition ($ service );
1202
+ }
1203
+ }
1204
+ }
1205
+
1168
1206
if ($ container ->fileExists ($ defaultDir )) {
1169
1207
$ dirs [] = $ defaultDir ;
1170
1208
} else {
@@ -1211,42 +1249,6 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
1211
1249
1212
1250
$ translator ->replaceArgument (4 , $ options );
1213
1251
}
1214
-
1215
- if (!empty ($ config ['remotes ' ])) {
1216
- if (empty ($ config ['enabled_locales ' ])) {
1217
- throw new LogicException ('You must specify framework.translator.enabled_locales in order to use remotes. ' );
1218
- }
1219
-
1220
- if ($ container ->hasDefinition ('console.command.translation_pull ' )) {
1221
- $ container ->getDefinition ('console.command.translation_pull ' )
1222
- ->replaceArgument (5 , $ transPaths )
1223
- ->replaceArgument (6 , $ config ['enabled_locales ' ])
1224
- ;
1225
- }
1226
-
1227
- if ($ container ->hasDefinition ('console.command.translation_push ' )) {
1228
- $ container ->getDefinition ('console.command.translation_push ' )
1229
- ->replaceArgument (3 , $ transPaths )
1230
- ->replaceArgument (4 , $ config ['enabled_locales ' ])
1231
- ;
1232
- }
1233
-
1234
- $ container ->getDefinition ('translation.remotes_factory ' )
1235
- ->replaceArgument (1 , $ config ['enabled_locales ' ])
1236
- ;
1237
-
1238
- $ container ->getDefinition ('translation.remotes ' )->setArgument (0 , $ config ['remotes ' ]);
1239
-
1240
- $ classToServices = [
1241
- LocoRemoteFactory::class => 'translation.remote_factory.loco ' ,
1242
- ];
1243
-
1244
- foreach ($ classToServices as $ class => $ service ) {
1245
- if (!class_exists ($ class )) {
1246
- $ container ->removeDefinition ($ service );
1247
- }
1248
- }
1249
- }
1250
1252
}
1251
1253
1252
1254
private function registerValidationConfiguration (array $ config , ContainerBuilder $ container , PhpFileLoader $ loader , bool $ propertyInfoEnabled )
0 commit comments