How to use the @hint/utils-i18n.getCategoryName function in @hint/utils-i18n

To help you get started, we’ve selected a few @hint/utils-i18n examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webhintio / hint / packages / formatter-html / src / result.ts View on Github external
public constructor(name: string, url: string, isScanner: boolean, language?: string) {
        this.hints = [];
        this.passed = [];
        this.name = name;
        this.localizedName = getCategoryName(name.toLowerCase() as Category, language);

        this.hintsCount = 0;

        this.image = categoryImages[name.toLowerCase()];
        this.isScanner = isScanner;

        if (this.image && !isScanner) {
            this.image = this.image.substr(1);
        }

        this.status = 'finished';
        this.url = url;
    }
github webhintio / hint / packages / extension-browser / src / devtools / views / controls / feedback-link.tsx View on Github external
useEffect(() => {
        const disabledCategories = config.disabledCategories || [];
        const browserslists = config.browserslist || '';
        const ignoredUrls = config.ignoredUrls;

        let body = template
            .replace('__webhint version:__', `__webhint version:__ ${version}`)
            .replace('__Browser version:__', `__Browser version:__ ${navigator.userAgent}`)
            .replace('[x] Recommended settings', `[${!browserslists ? 'x' : ' '}] Recommended settings`)
            .replace('[ ] Custom: ', `[${browserslists ? 'x' : ' '}] Custom: ${browserslists ? browserslists : ''} `);

        for (const category of categories) {
            body = body.replace(`[x] ${getCategoryName(category)}`, `[${disabledCategories.includes(category) ? ' ' : 'x'}] ${getCategoryName(category)}`);
        }

        if (error) {
            body = body.replace('', `${error.message}\n${error.stack}`);
        }

        const getLocation = async () => {
            const loc = await evaluate('window.location');
            const origin = loc.origin;
            const noIgnored = ignoredUrls === undefined;
            const isSameOrigin = !noIgnored && (ignoredUrls === '--webhint-third-party' || ignoredUrls === `^(?!${escapeRegExp(origin)})`);
            const isCustom = !noIgnored && !isSameOrigin;

            body = body.replace('[x] None', `* [${noIgnored ? 'x' : ' '}] None`)
                .replace('[ ] Different origin', `* [${isSameOrigin ? 'x' : ' '}] Different origin`)
                .replace('[ ] Custom: ', `* [${isCustom ? 'x' : ' '}] Custom: ${isCustom ? ignoredUrls : ''} `);
github webhintio / hint / packages / extension-browser / src / devtools / views / pages / config / sections / categories.tsx View on Github external
const categoryInputs = categories.map((category) => {
        const isDisabled = disabled && disabled.includes(category);

        return (
            
                
                
                    {getCategoryName(category)}
                
            
        );
    });
github webhintio / hint / packages / extension-browser / src / devtools / views / pages / results / category.tsx View on Github external
const Category = ({ name, hints, showPassed }: Props) => {
    const shownHints = hints.filter((hint) => {
        return showPassed || hint.problems.length > 0;
    });

    return (
        <div>
            <div id="{`results-category-${name}`}">
                <span>
                    {getCategoryName(name)}
                </span>
            </div>
            <div>
                {shownHints.map((hint) =&gt; {
                    return ;
                })}
            </div>
        </div>
    );
};
github webhintio / hint / packages / extension-browser / src / devtools / views / pages / results / category-summary.tsx View on Github external
const CategorySummary = ({ name, hints, passed }: CategoryResults) =&gt; {
    let statusStyle = '';

    if (passed &lt; hints.length) {
        statusStyle = hasError(hints) ? styles.error : styles.warn;
    }

    return (
        <a data-icon="{name}" href="{`#results-category-${name}`}">
            {getCategoryName(name)}
            <span>{hints.length - passed}</span>
        </a>
    );
};

@hint/utils-i18n

util for i18n

Apache-2.0
Latest version published 2 years ago

Package Health Score

75 / 100
Full package analysis