Skip to content

Commit c92c21e

Browse files
committed
fix binary packaging
1 parent 4327ba3 commit c92c21e

6 files changed

Lines changed: 48 additions & 48 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
Project versioning adheres to [Semantic Versioning](http://semver.org/).
66
Change log format is based on [Keep a Changelog](http://keepachangelog.com/).
77

8+
## [12.0.2](https://github.com/locize/locize-cli/compare/v12.0.1...v12.0.2) - 2026-01-13
9+
10+
- fix binary packaging
11+
812
## [12.0.1](https://github.com/locize/locize-cli/compare/v12.0.0...v12.0.1) - 2026-01-13
913

1014
- update dependencies

src/convertToDesiredFormat.js

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import flatten from 'flat'
2-
import i18next2po from 'gettext-converter/i18next2po'
2+
import gettextConv from 'gettext-converter'
33
import csv from 'fast-csv'
44
import xlsx from 'xlsx'
55
import yaml from 'yaml'
6-
import js2asr from 'android-string-resource/js2asr'
6+
import asr from 'android-string-resource'
77
import stringsFile from 'strings-file'
8-
import createxliff from 'xliff/createxliff'
9-
import createxliff12 from 'xliff/createxliff12'
10-
import js2resx from 'resx/js2resx'
11-
import js2ftl from 'fluent_conv/js2ftl'
12-
import js2tmx from 'tmexchange/js2tmx'
13-
import js2laravel from 'laravelphp/js2laravel'
8+
import xliff from 'xliff'
9+
import resx from 'resx'
10+
import fluentConv from 'fluent_conv'
11+
import tmexchange from 'tmexchange'
12+
import laravelphp from 'laravelphp'
1413
import javaProperties from '@js.properties/properties'
1514
import unflatten from './unflatten.js'
1615
import getRemoteNamespace from './getRemoteNamespace.js'
@@ -52,7 +51,7 @@ const convertToDesiredFormat = async (
5251
ctxSeparator: '_ is default but we set it to something that is never found!!!',
5352
persistMsgIdPlural: true
5453
}
55-
return i18next2po(lng, flatData, gettextOpt)
54+
return gettextConv.i18next2po(lng, flatData, gettextOpt)
5655
}
5756
if (opt.format === 'po_i18next' || opt.format === 'gettext_i18next') {
5857
const flatData = flatten(data)
@@ -64,7 +63,7 @@ const convertToDesiredFormat = async (
6463
poRevisionDate: lastModified,
6564
compatibilityJSON
6665
}
67-
return i18next2po(lng, flatData, gettextOpt)
66+
return gettextConv.i18next2po(lng, flatData, gettextOpt)
6867
}
6968
if (opt.format === 'csv') {
7069
const refNs = await opt.getNamespace(opt, opt.referenceLanguage, namespace)
@@ -134,7 +133,7 @@ const convertToDesiredFormat = async (
134133
return yaml.stringify(removeUndefinedFromArrays(newDataNs))
135134
}
136135
if (opt.format === 'android') {
137-
return await js2asr(flatten(data))
136+
return await asr.js2asr(flatten(data))
138137
}
139138
if (opt.format === 'strings') {
140139
Object.keys(data).forEach((k) => {
@@ -150,14 +149,14 @@ const convertToDesiredFormat = async (
150149
) {
151150
const fn =
152151
opt.format === 'xliff12' || opt.format === 'xlf12'
153-
? createxliff12
154-
: createxliff
152+
? xliff.createxliff12
153+
: xliff.createxliff
155154
const refNs = await opt.getNamespace(opt, opt.referenceLanguage, namespace)
156155
const prepared = prepareCombinedExport(refNs, flatten(data))
157156
return await fn(opt.referenceLanguage, lng, prepared.ref, prepared.trg, namespace)
158157
}
159158
if (opt.format === 'resx') {
160-
return await js2resx(flatten(data))
159+
return await resx.js2resx(flatten(data))
161160
}
162161
if (opt.format === 'fluent') {
163162
Object.keys(data).forEach((k) => {
@@ -167,7 +166,7 @@ const convertToDesiredFormat = async (
167166
String.fromCharCode(32)
168167
)
169168
})
170-
return js2ftl(unflatten(data))
169+
return fluentConv.js2ftl(unflatten(data))
171170
}
172171
if (opt.format === 'tmx') {
173172
const refNs = await opt.getNamespace(opt, opt.referenceLanguage, namespace)
@@ -189,10 +188,10 @@ const convertToDesiredFormat = async (
189188
sourceLanguage: opt.referenceLanguage
190189
}
191190
)
192-
return await js2tmx(js2TmxData)
191+
return await tmexchange.js2tmx(js2TmxData)
193192
}
194193
if (opt.format === 'laravel') {
195-
return await js2laravel(unflatten(data))
194+
return await laravelphp.js2laravel(unflatten(data))
196195
}
197196
if (opt.format === 'properties') {
198197
return javaProperties.stringifyFromProperties(data, { eol: '\n' })

src/convertToFlatFormat.js

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
import po2i18next from 'gettext-converter/po2i18next'
1+
import gettextConv from 'gettext-converter'
22
import csv from 'fast-csv'
33
import xlsx from 'xlsx'
44
import yaml from 'yaml'
5-
import asr2js from 'android-string-resource/asr2js'
5+
import asr from 'android-string-resource'
66
import stringsFile from 'strings-file'
7-
import xliff2js from 'xliff/xliff2js'
8-
import xliff12ToJs from 'xliff/xliff12ToJs'
9-
import targetOfjs from 'xliff/targetOfjs'
10-
import sourceOfjs from 'xliff/sourceOfjs'
11-
import resx2js from 'resx/resx2js'
12-
import ftl2js from 'fluent_conv/ftl2js'
13-
import tmx2js from 'tmexchange/tmx2js'
14-
import laravel2js from 'laravelphp/laravel2js'
7+
import xliff from 'xliff'
8+
import resx from 'resx'
9+
import fluentConv from 'fluent_conv'
10+
import tmexchange from 'tmexchange'
11+
import laravelphp from 'laravelphp'
1512
import javaProperties from '@js.properties/properties'
16-
import xcstrings2locize from 'locize-xcstrings/xcstrings2locize'
13+
import xcstrings from 'locize-xcstrings'
1714
import flatten from 'flat'
1815
import { prepareImport as prepareCombinedImport } from './combineSubkeyPreprocessor.js'
1916

@@ -28,7 +25,7 @@ const convertToFlatFormat = async (opt, data, lng) => {
2825
return flatten(jsonParsed)
2926
}
3027
if (opt.format === 'po' || opt.format === 'gettext') {
31-
const ret = po2i18next(data.toString(), {
28+
const ret = gettextConv.po2i18next(data.toString(), {
3229
persistMsgIdPlural: true,
3330
ignoreCtx: true
3431
})
@@ -37,7 +34,7 @@ const convertToFlatFormat = async (opt, data, lng) => {
3734
if (opt.format === 'po_i18next' || opt.format === 'gettext_i18next') {
3835
const potxt = data.toString()
3936
const compatibilityJSON = /msgctxt "(zero|one|two|few|many|other)"/.test(potxt) && 'v4'
40-
const ret = po2i18next(potxt, { compatibilityJSON })
37+
const ret = gettextConv.po2i18next(potxt, { compatibilityJSON })
4138
return flatten(ret)
4239
}
4340
if (opt.format === 'csv') {
@@ -98,7 +95,7 @@ const convertToFlatFormat = async (opt, data, lng) => {
9895
return flatten(jsObjn[Object.keys(jsObjn)[0]][Object.keys(jsObjn[Object.keys(jsObjn)[0]])[0]])
9996
}
10097
if (opt.format === 'android') {
101-
const res = await asr2js(data.toString(), { comment: 'right' })
98+
const res = await asr.asr2js(data.toString(), { comment: 'right' })
10299
Object.keys(res).forEach((k) => {
103100
if (res[k] !== 'string' && typeof res[k].comment === 'string') {
104101
res[k] = {
@@ -125,8 +122,8 @@ const convertToFlatFormat = async (opt, data, lng) => {
125122
) {
126123
const fn =
127124
opt.format === 'xliff12' || opt.format === 'xlf12'
128-
? xliff12ToJs
129-
: xliff2js
125+
? xliff.xliff12ToJs
126+
: xliff.xliff2js
130127
const res = await fn(data.toString())
131128
res.resources = res.resources || {}
132129
const ns = Object.keys(res.resources)[0]
@@ -145,22 +142,22 @@ const convertToFlatFormat = async (opt, data, lng) => {
145142
return prepareCombinedImport(nsRes)
146143
}
147144
if (!res.targetLanguage) {
148-
const ret = await sourceOfjs(res)
145+
const ret = await xliff.sourceOfjs(res)
149146
return checkForPostProcessing(ret)
150147
} else {
151-
let ret = targetOfjs(res)
148+
let ret = xliff.targetOfjs(res)
152149
if (lng !== opt.referenceLanguage) return checkForPostProcessing(ret)
153150
ret = ret || {}
154151
const keys = Object.keys(ret)
155152
if (keys.length === 0) return checkForPostProcessing(ret)
156153
const allEmpty = keys.filter((k) => ret[k] !== '').length === 0
157154
if (!allEmpty) return checkForPostProcessing(ret)
158-
ret = await sourceOfjs(res)
155+
ret = await xliff.sourceOfjs(res)
159156
return checkForPostProcessing(ret)
160157
}
161158
}
162159
if (opt.format === 'resx') {
163-
let res = await resx2js(data.toString())
160+
let res = await resx.resx2js(data.toString())
164161
res = Object.keys(res).reduce((mem, k) => {
165162
const value = res[k]
166163
if (typeof value === 'string') {
@@ -176,7 +173,7 @@ const convertToFlatFormat = async (opt, data, lng) => {
176173
return res
177174
}
178175
if (opt.format === 'fluent') {
179-
const fluentJS = ftl2js(
176+
const fluentJS = fluentConv.ftl2js(
180177
data
181178
.toString()
182179
.replace(
@@ -203,7 +200,7 @@ const convertToFlatFormat = async (opt, data, lng) => {
203200
return res
204201
}
205202
if (opt.format === 'tmx') {
206-
const jsonData = await tmx2js(data.toString())
203+
const jsonData = await tmexchange.tmx2js(data.toString())
207204
const tmxJsRes = jsonData.resources[Object.keys(jsonData.resources)[0]]
208205
const res = {}
209206
if (tmxJsRes) {
@@ -214,14 +211,14 @@ const convertToFlatFormat = async (opt, data, lng) => {
214211
return res
215212
}
216213
if (opt.format === 'laravel') {
217-
const res = await laravel2js(data.toString())
214+
const res = await laravelphp.laravel2js(data.toString())
218215
return flatten(res)
219216
}
220217
if (opt.format === 'properties') {
221218
return javaProperties.parseToProperties(data.toString())
222219
}
223220
if (opt.format === 'xcstrings') {
224-
return xcstrings2locize(data.toString())
221+
return xcstrings.xcstrings2locize(data.toString())
225222
}
226223
throw new Error(`${opt.format} is not a valid format!`)
227224
}

src/download.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import getRemoteLanguages from './getRemoteLanguages.js'
1010
import convertToDesiredFormat from './convertToDesiredFormat.js'
1111
import * as formats from './formats.js'
1212
import getProjectStats from './getProjectStats.js'
13-
import locize2xcstrings from 'locize-xcstrings/locize2xcstrings'
13+
import xcstrings from 'locize-xcstrings'
1414
import getBranches from './getBranches.js'
1515
import isValidUuid from './isValidUuid.js'
1616
import mapLimit from './mapLimit.js'
@@ -68,7 +68,7 @@ async function handleDownload (opt, url, err, res, downloads) {
6868
locizeData.resources[language] = nsData
6969
})
7070
try {
71-
const converted = locize2xcstrings(locizeData)
71+
const converted = xcstrings.locize2xcstrings(locizeData)
7272
const filledMask = opt.pathMask.replace(`${opt.pathMaskInterpolationPrefix}language${opt.pathMaskInterpolationSuffix}`, '').replace(`${opt.pathMaskInterpolationPrefix}namespace${opt.pathMaskInterpolationSuffix}`, ns) + reversedFileExtensionsMap[opt.format]
7373
let mkdirPath
7474
if (filledMask.lastIndexOf(path.sep) > 0) {
@@ -156,7 +156,7 @@ async function handlePull (opt, toDownload) {
156156
locizeData.resources[language] = nsData
157157
})
158158
try {
159-
const result = locize2xcstrings(locizeData)
159+
const result = xcstrings.locize2xcstrings(locizeData)
160160
const converted = JSON.stringify(result, null, 2)
161161
const filledMask = opt.pathMask.replace(`${opt.pathMaskInterpolationPrefix}language${opt.pathMaskInterpolationSuffix}`, '').replace(`${opt.pathMaskInterpolationPrefix}namespace${opt.pathMaskInterpolationSuffix}`, namespace) + reversedFileExtensionsMap[opt.format]
162162
let mkdirPath

src/parseLocalLanguage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import path from 'node:path'
33
import { mkdirp } from 'mkdirp'
44
import convertToFlatFormat from './convertToFlatFormat.js'
55
import * as formats from './formats.js'
6-
import xcstrings2locize from 'locize-xcstrings/xcstrings2locize'
6+
import xcstrings from 'locize-xcstrings'
77
const fileExtensionsMap = formats.fileExtensionsMap
88
const acceptedFileExtensions = formats.acceptedFileExtensions
99

@@ -142,7 +142,7 @@ const parseLocalLanguage = async (opt, lng) => {
142142
}
143143
if (opt.format === 'xcstrings') {
144144
try {
145-
const content = xcstrings2locize(data)
145+
const content = xcstrings.xcstrings2locize(data)
146146
const stat = await fs.promises.stat(fPath)
147147
return Object.keys(content.resources).map((l) => ({
148148
namespace,

src/sync.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import parseLocalReference from './parseLocalReference.js'
1414
import * as formats from './formats.js'
1515
import deleteNamespace from './deleteNamespace.js'
1616
import getProjectStats from './getProjectStats.js'
17-
import locize2xcstrings from 'locize-xcstrings/locize2xcstrings'
17+
import xcstrings from 'locize-xcstrings'
1818
import getBranches from './getBranches.js'
1919
import isValidUuid from './isValidUuid.js'
2020
import os from 'node:os'
@@ -352,7 +352,7 @@ async function downloadAll (opt, remoteLanguages, omitRef = false, manipulate) {
352352
})
353353

354354
try {
355-
const converted = locize2xcstrings(locizeData)
355+
const converted = xcstrings.locize2xcstrings(locizeData)
356356

357357
const filledMask = opt.pathMask.replace(`${opt.pathMaskInterpolationPrefix}language${opt.pathMaskInterpolationSuffix}`, '').replace(`${opt.pathMaskInterpolationPrefix}namespace${opt.pathMaskInterpolationSuffix}`, namespace) + reversedFileExtensionsMap[opt.format]
358358
if (opt.dry) return

0 commit comments

Comments
 (0)