@@ -156,7 +156,7 @@ function genLangFile(lang, dest) {
156156 const reactSdkFile = 'node_modules/matrix-react-sdk/src/i18n/strings/' + lang + '.json' ;
157157 const riotWebFile = 'src/i18n/strings/' + lang + '.json' ;
158158
159- let translations = { } ;
159+ const translations = { } ;
160160 [ reactSdkFile , riotWebFile ] . forEach ( function ( f ) {
161161 if ( fs . existsSync ( f ) ) {
162162 Object . assign (
@@ -165,9 +165,6 @@ function genLangFile(lang, dest) {
165165 ) ;
166166 }
167167 } ) ;
168-
169- translations = weblateToCounterpart ( translations )
170-
171168 fs . writeFileSync ( dest + lang + '.json' , JSON . stringify ( translations , null , 4 ) ) ;
172169 if ( verbose ) {
173170 console . log ( "Generated language file: " + lang ) ;
@@ -196,39 +193,5 @@ function genLangList() {
196193 }
197194}
198195
199- /**
200- * Convert translation key from weblate format
201- * (which only supports a single level) to counterpart
202- * which requires object values for 'count' translations.
203- *
204- * eg.
205- * "there are %(count)s badgers|one": "a badger",
206- * "there are %(count)s badgers|other": "%(count)s badgers"
207- * becomes
208- * "there are %(count)s badgers": {
209- * "one": "a badger",
210- * "other": "%(count)s badgers"
211- * }
212- */
213- function weblateToCounterpart ( inTrs ) {
214- const outTrs = { } ;
215-
216- for ( const key of Object . keys ( inTrs ) ) {
217- const keyParts = key . split ( '|' , 2 ) ;
218- if ( keyParts . length === 2 ) {
219- let obj = outTrs [ keyParts [ 0 ] ] ;
220- if ( obj === undefined ) {
221- obj = { } ;
222- outTrs [ keyParts [ 0 ] ] = obj ;
223- }
224- obj [ keyParts [ 1 ] ] = inTrs [ key ] ;
225- } else {
226- outTrs [ key ] = inTrs [ key ] ;
227- }
228- }
229-
230- return outTrs ;
231- }
232-
233196genLangList ( ) ;
234197next ( 0 ) ;
0 commit comments