Skip to content

Commit

Permalink
sync: optimize handling if pathmask does not include namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Feb 10, 2022
1 parent da532f1 commit d2995a1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
Project versioning adheres to [Semantic Versioning](http://semver.org/).
Change log format is based on [Keep a Changelog](http://keepachangelog.com/).

## [7.8.1](https://github.com/locize/locize-cli/compare/v7.8.0...v7.8.1) - 2022-02-10

- sync: optimize handling if pathmask does not include namespace


## [7.8.0](https://github.com/locize/locize-cli/compare/v7.7.2...v7.8.0) - 2022-01-13

- sync: introduce --delete-remote-namespace option
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"@js.properties/properties": "0.5.4",
"android-string-resource": "2.3.4",
"async": "3.2.2",
"async": "3.2.3",
"colors": "1.4.0",
"commander": "7.2.0",
"csvjson": "5.1.0",
Expand All @@ -23,18 +23,18 @@
"laravelphp": "2.0.3",
"lodash.clonedeep": "4.5.0",
"mkdirp": "1.0.4",
"node-fetch": "2.6.6",
"node-fetch": "2.6.7",
"resx": "2.0.3",
"rimraf": "3.0.2",
"strings-file": "0.0.5",
"tmexchange": "2.0.4",
"xliff": "5.7.2",
"xlsx": "0.17.4"
"xliff": "6.0.1",
"xlsx": "0.18.0"
},
"devDependencies": {
"eslint": "7.32.0",
"gh-release": "6.0.1",
"pkg": "5.5.1"
"pkg": "5.5.2"
},
"scripts": {
"lint": "eslint .",
Expand Down
3 changes: 3 additions & 0 deletions parseLocalLanguage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const getDirectories = (srcpath) => {
};

const parseLocalLanguage = (opt, lng, cb) => {
const hasNamespaceInPath = opt.pathMask.indexOf(`${opt.pathMaskInterpolationPrefix}namespace${opt.pathMaskInterpolationSuffix}`) > -1;
const filledLngMask = opt.pathMask.replace(`${opt.pathMaskInterpolationPrefix}language${opt.pathMaskInterpolationSuffix}`, lng);
var firstPartLngMask, lastPartLngMask;
if (opt.pathMask.indexOf(`${opt.pathMaskInterpolationPrefix}language${opt.pathMaskInterpolationSuffix}`) > opt.pathMask.indexOf(`${opt.pathMaskInterpolationPrefix}namespace${opt.pathMaskInterpolationSuffix}`)) {
Expand Down Expand Up @@ -114,6 +115,8 @@ const parseLocalLanguage = (opt, lng, cb) => {
} else {
namespace = dirPath.substring(filledNsMask.indexOf(nsMask));
}
} else if (!hasNamespaceInPath && startNsIndex < 0) {
namespace = opt.namespace;
}
var fPath = path.join(opt.path, lngPath || '', file);
if (dirPath && lngPath.indexOf(nsMask) > -1) {
Expand Down

0 comments on commit d2995a1

Please sign in to comment.