TrigenSoftware / DevFest-Siberia

DevFest Siberia 2019 site
https://devfest-siberia-2019-demo.netlify.com
MIT License
2 stars 0 forks source link

Локали для блоков #34

Closed dangreen closed 5 years ago

dangreen commented 5 years ago

Пример в https://github.com/dangreen/DevFest-Siberia/pull/33

Посмотри примеры использования:

Пока что просто переводы (заполнить json файлы), в код встраивать не надо

Что-то можно взять со старого сайта, что то простое сам переведи, большие тексты без перевода - оставляй на русском.

Команда, спонсоры... - массивами

Rustamhabibullin commented 5 years ago

@dangreen, для Team json должен выглядеть вот так?

{
    "main": {
        "title": "DevFest Siberia 2019",
        "address": "Novosibirsk",
        "dates": "29<>november</><>-</>01<>december</>",
        "year": "2019"
    },
    "team": [
        {
            "firstname": "Fistname",
            "lastname": "Lastname",
            "description": "Роль, занятие, цель смысл"
        },
        {
            "firstname": "Fistname",
            "lastname": "Lastname",
            "description": "Роль, занятие, цель смысл"
        },
        {
            "firstname": "Fistname",
            "lastname": "Lastname",
            "description": "Роль, занятие, цель смысл"
        }
    ]
}

В таком случае при пуше вот такая вот ошибка:

src/App/blocks/Main/Main.stories.tsx:35:5 - error TS2322: Type '{ "main": { "title": string; "address": string; "dates": string; "year": string; }; "team": { "firstname": string; "lastname": string; "description": string; }[]; }' is not assignable to type 'string | number | ILocales'.
  Type '{ "main": { "title": string; "address": string; "dates": string; "year": string; }; "team": { "firstname": string; "lastname": string; "description": string; }[]; }' is not assignable to type 'ILocales'.

35                      ru,
                        ~~

  node_modules/i18n-for-browser/lib/config.d.ts:3:5
    3     [key: string]: number | string | ILocales;
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from this index signature.

src/App/blocks/Main/Main.stories.tsx:36:5 - error TS2322: Type '{ "main": { "title": string; "address": string; "dates": string; "year": string; }; "team": { "firstname": string; "lastname": string; "description": string; }[]; }' is not assignable to type 'string | number | ILocales'.
  Type '{ "main": { "title": string; "address": string; "dates": string; "year": string; }; "team": { "firstname": string; "lastname": string; "description": string; }[]; }' is not assignable to type 'ILocales'.

36                      en
                        ~~

  node_modules/i18n-for-browser/lib/config.d.ts:3:5
    3     [key: string]: number | string | ILocales;
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from this index signature.

src/App/blocks/landing.stories.tsx:49:5 - error TS2322: Type '{ "main": { "title": string; "address": string; "dates": string; "year": string; }; "team": { "firstname": string; "lastname": string; "description": string; }[]; }' is not assignable to type 'string | number | ILocales'.
  Type '{ "main": { "title": string; "address": string; "dates": string; "year": string; }; "team": { "firstname": string; "lastname": string; "description": string; }[]; }' is not assignable to type 'ILocales'.
    Property '"team"' is incompatible with index signature.
      Type '{ "firstname": string; "lastname": string; "description": string; }[]' is not assignable to type 'string | number | ILocales'.
        Type '{ "firstname": string; "lastname": string; "description": string; }[]' is not assignable to type 'ILocales'.
          Index signature is missing in type '{ "firstname": string; "lastname": string; "description": string; }[]'.

49                      ru,
                        ~~

  node_modules/i18n-for-browser/lib/config.d.ts:3:5
    3     [key: string]: number | string | ILocales;
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from this index signature.

src/App/blocks/landing.stories.tsx:50:5 - error TS2322: Type '{ "main": { "title": string; "address": string; "dates": string; "year": string; }; "team": { "firstname": string; "lastname": string; "description": string; }[]; }' is not assignable to type 'string | number | ILocales'.
  Type '{ "main": { "title": string; "address": string; "dates": string; "year": string; }; "team": { "firstname": string; "lastname": string; "description": string; }[]; }' is not assignable to type 'ILocales'.
    Property '"team"' is incompatible with index signature.
      Type '{ "firstname": string; "lastname": string; "description": string; }[]' is not assignable to type 'string | number | ILocales'.
        Type '{ "firstname": string; "lastname": string; "description": string; }[]' is not assignable to type 'ILocales'.
          Index signature is missing in type '{ "firstname": string; "lastname": string; "description": string; }[]'.

50                      en
                        ~~

  node_modules/i18n-for-browser/lib/config.d.ts:3:5
    3     [key: string]: number | string | ILocales;
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from this index signature.

Found 4 errors.

npm ERR! Test failed.  See above for more details.
husky > pre-push hook failed (add --no-verify to bypass)
error: failed to push some refs to 'https://github.com/dangreen/DevFest-Siberia.git'
dangreen commented 5 years ago

@Rustamhabibullin поправил i18n-for-browser

смотри и делай как тут https://github.com/dangreen/DevFest-Siberia/pull/39/files

теперь уже и с кодом тоже