@@ -2,7 +2,7 @@ use crate::formats::{self, parse_custom_format};
22use crate :: transformers:: custom_format_to_resource;
33use crate :: validation:: { self , validate_custom_format_file} ;
44
5- use langcodec:: { convert_auto, formats:: FormatType , Codec } ;
5+ use langcodec:: { Codec , convert_auto, formats:: FormatType } ;
66use std:: fs:: File ;
77use std:: io:: BufWriter ;
88
@@ -125,8 +125,7 @@ pub fn run_unified_convert_command(input: String, output: String, options: Conve
125125 }
126126
127127 // If exclude_lang is specified, exclude those languages
128- if !options. exclude_lang . is_empty ( ) && options. exclude_lang . contains ( lang)
129- {
128+ if !options. exclude_lang . is_empty ( ) && options. exclude_lang . contains ( lang) {
130129 return false ;
131130 }
132131
@@ -138,18 +137,19 @@ pub fn run_unified_convert_command(input: String, output: String, options: Conve
138137 } ,
139138 ) {
140139 Ok ( ( ) ) => {
141- let filter_msg = if !options. include_lang . is_empty ( ) || !options. exclude_lang . is_empty ( ) {
142- let mut parts = Vec :: new ( ) ;
143- if !options. include_lang . is_empty ( ) {
144- parts. push ( format ! ( "including: {}" , options. include_lang. join( ", " ) ) ) ;
145- }
146- if !options. exclude_lang . is_empty ( ) {
147- parts. push ( format ! ( "excluding: {}" , options. exclude_lang. join( ", " ) ) ) ;
148- }
149- format ! ( " with language filtering ({})" , parts. join( ", " ) )
150- } else {
151- String :: new ( )
152- } ;
140+ let filter_msg =
141+ if !options. include_lang . is_empty ( ) || !options. exclude_lang . is_empty ( ) {
142+ let mut parts = Vec :: new ( ) ;
143+ if !options. include_lang . is_empty ( ) {
144+ parts. push ( format ! ( "including: {}" , options. include_lang. join( ", " ) ) ) ;
145+ }
146+ if !options. exclude_lang . is_empty ( ) {
147+ parts. push ( format ! ( "excluding: {}" , options. exclude_lang. join( ", " ) ) ) ;
148+ }
149+ format ! ( " with language filtering ({})" , parts. join( ", " ) )
150+ } else {
151+ String :: new ( )
152+ } ;
153153
154154 println ! (
155155 "✅ Successfully converted to .langcodec (Resource JSON array){}" ,
@@ -158,18 +158,19 @@ pub fn run_unified_convert_command(input: String, output: String, options: Conve
158158 return ;
159159 }
160160 Err ( e) => {
161- let filter_msg = if !options. include_lang . is_empty ( ) || !options. exclude_lang . is_empty ( ) {
162- let mut parts = Vec :: new ( ) ;
163- if !options. include_lang . is_empty ( ) {
164- parts. push ( format ! ( "including: {}" , options. include_lang. join( ", " ) ) ) ;
165- }
166- if !options. exclude_lang . is_empty ( ) {
167- parts. push ( format ! ( "excluding: {}" , options. exclude_lang. join( ", " ) ) ) ;
168- }
169- format ! ( " with language filtering ({})" , parts. join( ", " ) )
170- } else {
171- String :: new ( )
172- } ;
161+ let filter_msg =
162+ if !options. include_lang . is_empty ( ) || !options. exclude_lang . is_empty ( ) {
163+ let mut parts = Vec :: new ( ) ;
164+ if !options. include_lang . is_empty ( ) {
165+ parts. push ( format ! ( "including: {}" , options. include_lang. join( ", " ) ) ) ;
166+ }
167+ if !options. exclude_lang . is_empty ( ) {
168+ parts. push ( format ! ( "excluding: {}" , options. exclude_lang. join( ", " ) ) ) ;
169+ }
170+ format ! ( " with language filtering ({})" , parts. join( ", " ) )
171+ } else {
172+ String :: new ( )
173+ } ;
173174
174175 println ! ( "❌ Conversion to .langcodec failed{}" , filter_msg) ;
175176 eprintln ! ( "Error: {}" , e) ;
@@ -186,7 +187,10 @@ pub fn run_unified_convert_command(input: String, output: String, options: Conve
186187 }
187188
188189 // Strategy 2: Try custom formats for JSON/YAML/langcodec files
189- if input. ends_with ( ".json" ) || input. ends_with ( ".yaml" ) || input. ends_with ( ".yml" ) || input. ends_with ( ".langcodec" )
190+ if input. ends_with ( ".json" )
191+ || input. ends_with ( ".yaml" )
192+ || input. ends_with ( ".yml" )
193+ || input. ends_with ( ".langcodec" )
190194 {
191195 // For JSON files without explicit format, try standard format detection first
192196 if input. ends_with ( ".json" ) && options. input_format . is_none ( ) {
@@ -557,4 +561,3 @@ pub fn read_resources_from_any_input(
557561 input
558562 ) )
559563}
560-
0 commit comments