@@ -15,9 +15,7 @@ var _languages = require("../util/languages");
1515
1616var _source = require ( "../util/source" ) ;
1717
18- var _path = require ( "path" ) ;
19-
20- var _fs = require ( "fs" ) ;
18+ var _helpers = require ( "../util/helpers" ) ;
2119
2220function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { "default" : obj } ; }
2321
@@ -84,9 +82,7 @@ function _default(config) {
8482 sourceTranslations . forEach ( function ( segment ) {
8583 updatedSourceTranslations [ segment . key ] = segment . target ;
8684 } ) ;
87- ( 0 , _fs . writeFileSync ) ( ( 0 , _path . join ) ( process . cwd ( ) , config . translations_directory , "" . concat ( config . source_locale , ".json" ) ) , JSON . stringify ( updatedSourceTranslations , null , 4 ) , {
88- encoding : 'utf8'
89- } ) ;
85+ ( 0 , _helpers . writeLocaleFile ) ( config . source_locale , updatedSourceTranslations , config ) ;
9086 }
9187
9288 var api = new _Translation [ "default" ] ( config ) ;
@@ -114,9 +110,7 @@ function _default(config) {
114110 sourceTranslations . forEach ( function ( segment ) {
115111 translations [ segment . key ] = segment . target ;
116112 } ) ;
117- ( 0 , _fs . writeFileSync ) ( ( 0 , _path . join ) ( process . cwd ( ) , config . translations_directory , "" . concat ( config . source_locale , ".json" ) ) , JSON . stringify ( translations , null , 4 ) , {
118- encoding : 'utf8'
119- } ) ;
113+ ( 0 , _helpers . writeLocaleFile ) ( config . source_locale , translations , config ) ;
120114 } ) ;
121115 }
122116
@@ -133,9 +127,7 @@ function _default(config) {
133127 }
134128 }
135129 } ) ;
136- ( 0 , _fs . writeFileSync ) ( ( 0 , _path . join ) ( process . cwd ( ) , config . translations_directory , "" . concat ( locale , ".json" ) ) , JSON . stringify ( translations , null , 4 ) , {
137- encoding : 'utf8'
138- } ) ;
130+ ( 0 , _helpers . writeLocaleFile ) ( locale , translations , config ) ;
139131 } ) ;
140132
141133 if ( config . purge ) {
0 commit comments