Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: transloco-keys-manager find not working #127

Closed
1 task done
vshende2 opened this issue Mar 29, 2022 · 11 comments
Closed
1 task done

Bug: transloco-keys-manager find not working #127

vshende2 opened this issue Mar 29, 2022 · 11 comments

Comments

@vshende2
Copy link

vshende2 commented Mar 29, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Is this a regression?

No

Current behavior

npm run i18n:find

transloco-keys-manager find

馃暤 馃攷 Starting Search For Missing Keys 馃攳 馃暤

  • Extracting Template and Component Keys
    C:\UI_POC\UI\node_modules\esquery\dist\esquery.min.js:1
    .....
    ......
    e [SyntaxError]: Expected " " or "]" but "c" found.
    at Object.parse (C:\UI_POC\UI\node_modules\esquery\dist\esquery.min.js:1:29413)
    ........
    \UI\node_modules@ngneat\transloco-keys-manager\keys-builder\typescript\index.js:1:721) {
    expected: [
    { type: 'literal', text: ' ', ignoreCase: false },
    { type: 'literal', text: ']', ignoreCase: false }
    ],
    found: 'c',
    location: {
    start: { offset: 46, line: 2, column: 9 },
    end: { offset: 47, line: 2, column: 10 }
    }
    }

Expected behavior

It should return missing keys.

Please provide a link to a minimal reproduction of the bug

no-link

Transloco Config

module.exports = {
    rootTranslationsPath: 'assets/i18n/',
    langs: ['en'],
    keysManager: {},
};

Debug Logs

No response

Please provide the environment you discovered this bug in

Transloco: 4.0.0
Transloco Keys Manager:3.3.3
Angular:13.3
Node: 16.1.0
Package Manager: npm
OS:windows 2019 server

Additional context

No response

I would like to make a pull request for this bug

No

@shaharkazaz
Copy link
Collaborator

@vshende2 Please provide a reproduction.

@vshende2
Copy link
Author

@shaharkazaz sorry I don't have any demo project to repro. Could you please provide any sample where we can test transloco-keys-manager find command?

@shaharkazaz
Copy link
Collaborator

@vshende2 Just create a new Angular project and add Transloco and the Transloco keys manager.
You can maybe fork one of the reproductions provided in previous issues.

@HitomiTenshi
Copy link

HitomiTenshi commented Mar 30, 2022

I have a similar issue where it just outputs "Translations path provided doesn't exists!" even though the path exists.

The extract function works with the settings I have, only the find function doesn't work.

My config:

module.exports = {
  rootTranslationsPath: 'src/assets/i18n/',
  langs: ['de', 'en'],
  keysManager: {
    defaultValue: 'MissingTranslation',
    sort: true,
  },
};

Edit:
Adding -p src/assets/i18n or --translations-path src/assets/i18n to the find command doesn't work either.

@shaharkazaz
Copy link
Collaborator

@HitomiTenshi This isn't related to this issue. you are welcome to create a new issue and provide a reproduction, otherwise, it won't be resolved.

@vshende2
Copy link
Author

@shaharkazaz Unfortunately I am not able to create repro sample. I am just trying to use transloco key manager in my project. Please check if below full logs helps to guess the issue:

e [SyntaxError]: Expected " " or "]" but "c" found.
at Object.parse (C:\Workspace\UI_POC\UI\node_modules\esquery\dist\esquery.min.js:1:29413)
at Function.v [as parse] (C:\Workspace\UI_POC\UI\node_modules\esquery\dist\esquery.min.js:1:34883)
at Object.parse (C:\Workspace\UI_POC\UI\node_modules@ngneat\transloco-keys-manager\node_modules@phenomnomnominal\tsquery\dist\src\parse.js:9:34)
at query (C:\Workspace\UI_POC\UI\node_modules@ngneat\transloco-keys-manager\node_modules@phenomnomnominal\tsquery\dist\src\query.js:11:39)
at serviceExtractor (C:\Workspace\UI_POC\UI\node_modules@ngneat\transloco-keys-manager\keys-builder\typescript\service.extractor.js:1:505)
at C:\Workspace\UI_POC\UI\node_modules@ngneat\transloco-keys-manager\keys-builder\typescript\index.js:1:1163
at Array.map ()
at TSExtractor (C:\Workspace\UI_POC\UI\node_modules@ngneat\transloco-keys-manager\keys-builder\typescript\index.js:1:1155)
at extractKeys (C:\Workspace\UI_POC\UI\node_modules@ngneat\transloco-keys-manager\keys-builder\utils\extract-keys.js:1:1011)
at extractTSKeys (C:\Workspace\UI_POC\UI\node_modules@ngneat\transloco-keys-manager\keys-builder\typescript\index.js:1:721) {
expected: [
{ type: 'literal', text: ' ', ignoreCase: false },
{ type: 'literal', text: ']', ignoreCase: false }
],
found: 'c',
location: {
start: { offset: 46, line: 2, column: 9 },
end: { offset: 47, line: 2, column: 10 }
}
}

@shaharkazaz
Copy link
Collaborator

@vshende2 Please run the command in debug mode

@vshende2
Copy link
Author

@shaharkazaz I did "i18n:extract": "set DEBUG=* & transloco-keys-manager extract",
"i18n:find": "set DEBUG=* & transloco-keys-manager find"

and it throw same error after below

set DEBUG=* & transloco-keys-manager find

馃悶 DEBUG - Config:
Default: {
input: [ 'app' ],
output: 'assets/i18n',
langs: [ 'en' ],
marker: 't',
sort: false,
defaultValue: undefined,
replace: false,
addMissingKeys: false,
emitErrorOnExtraKeys: false,
translationsPath: 'assets/i18n'
} +0ms
Transloco file: { translationsPath: 'assets/i18n/', langs: [ 'de', 'en' ] } +4ms
Inline: { command: 'find' } +1ms
Merged: {
input: [ 'app' ],
output: 'assets/i18n',
langs: [ 'de', 'en' ],
marker: 't',
sort: false,
defaultValue: undefined,
replace: false,
addMissingKeys: false,
emitErrorOnExtraKeys: false,
translationsPath: 'assets/i18n/',
command: 'find'
} +0ms

馃悶 DEBUG - Configuration Paths:
Input: [ 'C:\Workspace\UI_POC\UI\main\app' ] +0ms
Output: 'C:\Workspace\UI_POC\UI\main\assets\i18n' +6ms
Translations: 'C:\Workspace\UI_POC\UI\main\assets\i18n' +0ms

馃悶 DEBUG - Scopes:
Scopes map: {
abc: 'abc',
xyz: 'xyz'

} +0ms

馃暤 馃攷 Starting Search For Missing Keys 馃攳 馃暤

@shaharkazaz
Copy link
Collaborator

@vshende2 Please update the package to v3.3.5 and run: set DEBUG=extraction & transloco-keys-manager extract this should isolate the problematic file.
Seems like tsquery is failing there for some reason.

@vshende2
Copy link
Author

vshende2 commented Mar 31, 2022

@shaharkazaz Thanks. Above solution works for me. 馃挴 ( Is there way to skip problematic file )

@shaharkazaz
Copy link
Collaborator

@vshende2 Not sure I fully understood your issue, happy it's resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants