$\def\gl{\mathrm{GL}} \def\Q{\mathbb{Q}} \DeclareMathOperator{\gal}{Gal} $
I am reading the Galois representation chapter of Diamond-Shurman "A first course in modular forms".
Let $L$ be a finite extension of a $\ell$-adic number field $\Q_{\ell}$. It is well known that $L$ can be expressed in a form $L=K_{\lambda}$ using a certain number field $K$ and its ideal $\lambda \mid \ell$. Let $G_{\Q}=\gal(\bar{\Q}/\Q)$ be the absolute Galois group of $\Q$.
Proposition 9.3.5. Let $\rho :G_{\Q}\to \gl_d(L)$ be a Galois representation. Then $\rho$ is "similar to" a Galois representation $\rho' :G_{\Q}\to \gl_d(\mathcal{O}_L)$.
First of all,I was not sure what "similar to" meant, because the book seems to use the word "equivalent" to express isomorphism as an representation.
Secondly, I could not understand the part of the proof enclosed by "" below. I quote the proof as follows:
Proof. Let $V=L^d$ and let $\Lambda=\mathcal{O}_{L}^d$.
Then $\Lambda$ is a lattice of $V$, hence a finitely generated $\mathbb{Z}_{\ell}$-module, hence compact as noted at the end of Section 9.2.
Since $G_{\mathbb{Q}}$ is compact as well, so is the image $\Lambda^{\prime}$ of $\Lambda \times G_{\mathbb{Q}}$ under the map $V \times$ $G_{\mathbb{Q}} \longrightarrow V$. Thus "the image lies in $\lambda^{-r} \Lambda$ for some $r \in \mathbb{Z}^{+}$". "The image is finitely generated, it contains $\Lambda$" so its rank is at least $d$, it is free since $\mathcal{O}_{L}$ is a principal ideal domain, and so its rank is exactly $d$.
"It is taken to itself by $G_{\mathbb{Q}}$". All of this combines to show that "any $\mathcal{O}_{L}$-basis of $\Lambda^{\prime}$ gives the desired $\rho^{\prime}$".
Please break the proof down for me.
Similar means finding $P\in GL_d(L)$ such that $\forall g\in G_\Bbb{Q},\rho'(g)=P \rho(g) P^{-1}$.
$(g,v)\mapsto \rho(g) v$ is meant to be continuous $ G_\Bbb{Q}\times L^d\to L^d$.
The point is that $G_\Bbb{Q}$ and $O_L^d$ are both compact, so $W$ the $O_L$-module generated by $\{ \rho(g)v, (g,v)\in G_\Bbb{Q}\times O_L^d\}$ is compact. This implies that $W$ is contained in $\ell^{-r} O_L^d$ for some $r$.
$O_L$ is a PID, so $\ell^{-r} O_L^d\supset W \supset O_L^d$ implies that $W$ is a rank $d$ free $O_L$ module, ie. there is some $P\in GL_d(L)$ such that $W=P O_L^d$.
That's it, letting $\rho'(g)= P \rho(g) P^{-1}$ then both $\rho'(g),\rho'(g)^{-1}$ are $L$-linear maps $O_L^d\to O_L^d$ ie. $\forall g\in G_\Bbb{Q},\rho'(g)\in GL_d(O_L)$.