mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-21 21:45:11 +00:00
ignore weirder cases
This commit is contained in:
parent
30d53de356
commit
f11536c927
2 changed files with 8 additions and 1 deletions
|
@ -23,7 +23,7 @@ function collectMembers(node) {
|
||||||
*/
|
*/
|
||||||
function walkDown(locale, path) {
|
function walkDown(locale, path) {
|
||||||
if (!locale) return null;
|
if (!locale) return null;
|
||||||
if (!path || path.length === 0) return locale;
|
if (!path || path.length === 0 || !path[0]) return locale;
|
||||||
return walkDown(locale[path[0]], path.slice(1));
|
return walkDown(locale[path[0]], path.slice(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +112,11 @@ function theRule(context) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we hit something weird, assume the programmers know what
|
||||||
|
// they're doing (this is usually some complicated slicing of
|
||||||
|
// the translation structure)
|
||||||
|
if (typeof(translation) !== 'string') return;
|
||||||
|
|
||||||
// some more checks on how the translation is called
|
// some more checks on how the translation is called
|
||||||
if (method == 'ts') {
|
if (method == 'ts') {
|
||||||
if (translation.match(/\{/)) {
|
if (translation.match(/\{/)) {
|
||||||
|
|
|
@ -11,6 +11,8 @@ ruleTester.run(
|
||||||
{
|
{
|
||||||
valid: [
|
valid: [
|
||||||
{code: 'i18n.ts.foo.bar', options: [locale] },
|
{code: 'i18n.ts.foo.bar', options: [locale] },
|
||||||
|
// we don't detect the problem here, but should still accept it
|
||||||
|
{code: 'i18n.ts.foo["something"]', options: [locale] },
|
||||||
{code: 'i18n.ts.top', options: [locale] },
|
{code: 'i18n.ts.top', options: [locale] },
|
||||||
{code: 'i18n.tsx.foo.baz({x:1})', options: [locale] },
|
{code: 'i18n.tsx.foo.baz({x:1})', options: [locale] },
|
||||||
{code: 'whatever.i18n.ts.blah.blah', options: [locale] },
|
{code: 'whatever.i18n.ts.blah.blah', options: [locale] },
|
||||||
|
|
Loading…
Reference in a new issue