I'm having troubles using the cross referencing system with LyX (version 2.1.1).
I place labels on the side of the environment i want to be able to make reference in the future, using the label function from gui. When i want to add a reference i use the reference function from gui. I choose the lable i want and, since i don't want just the numbers but also the environment name (e.g. : Section, Theorem, ecc..), i also select "Formatted reference".

I'm using ams classes since i need to input math. In particular, from Document > Settings > Modules i choose "Theorems (AMS, Numbered by Type), Theorems (AMS Extended, Numbered by Type), Theorems (Numbered by Type Within Sections)", plus others which have nothing to do with math (e.g. fixcm).
I'm also editing a document in Italian language, so i want references to be labled in Italian. Keep in mind that in the Lyx editor and in pdf i see correctly translated names for all the environments. The problems comes up only in cross referencing.

The problem is that if i make reference to a Theorem i get the label automatically placed, but in english (Theorem unstead of teorema). If i reference a Definition, i get nothing apart the numbers.

Seems that the problem with the appearance of only some kinds of evironment lables is common but trying some of the solutions proposed seems not to work for me.
For instance, adding the following:

```
\newcommand{\figref}[1]{Figure~\ref{#1}}
\newcommand{\tabref}[1]{Table~\ref{#1}}
\newcommand{\eqnref}[1]{Eq.~\ref{#1}}
\newcommand{\secref}[1]{Section~\ref{#1}}
\newcommand{\defref}[1]{Definition~\ref{#1}}

```

will give error, since LyX seems to add some kind of definition to be able to manage the only working lables (Theorems, Lemma, Section), by adding hte following:

```
\AtBeginDocument{\providecommand\thmref[1]{\ref{thm:#1}}}

\RS@ifundefined{subref}
  {\def\RSsubtxt{section~}\newref{sub}{name = \RSsubtxt}}
  {}
\RS@ifundefined{thmref}
  {\def\RSthmtxt{theorem~}\newref{thm}{name = \RSthmtxt}}
  {}
\RS@ifundefined{lemref}
  {\def\RSlemtxt{lemma~}\newref{lem}{name = \RSlemtxt}}
  {}

```

Any suggestions? Am i using LyX the wrong way? Any help will be appreciated.