$\mathbb{Q}/\mathbb{Z}$ decomposition and possible generalization I was wondering whether $\mathbb{Q}/\mathbb{Z}$ can be decomposed into a direct sum of its subgroups and I thought of the following decomposition: $$\mathbb{Q}/\mathbb{Z} = \bigoplus_{p \text{ prime}}\left(\mathbb{Z}\left[\frac{1}{p}\right]\Big/\mathbb{Z}\right).$$
The isomorphism is quite obvious as via CRT any fraction $\frac{m}{p_1^{\alpha_1}...p_k^{\alpha_k}}$ can be uniquely written as a sum $\frac{m_1}{p_1^{\alpha_1}} + ... + \frac{m_k}{p_1^{\alpha_k}} \:\mathrm{mod}\,\mathbb{Z}$. Firstly, I want to ask: is this reasoning correct and this is indeed how $\mathbb{Q}/\mathbb{Z}$ is decomposed?
Afterwards, I got a feeling that this somehow seems like something more general and not linked to this particular example. I figured that each summand in the decomposition above is in fact a localization of $\mathbb{Q}/\mathbb{Z}$ at a prime ideal $(p) \subset \mathbb{Z}$. So, if we consider $M = \mathbb{Q}/\mathbb{Z}$ as an $R$-module where $R = \mathbb{Z}$, we get the following decomposition:
\begin{align}M = \bigoplus_{\mathfrak{p} \in \mathrm{Spec}R \setminus \{(0)\}} M_\mathfrak{p}.\end{align}
So, my question is quite vague but I am too curious not to ask: $$\textbf{under which conditions can a module be decomposed in the above fashion?}$$

For finitely generated modules over principal ideal domains to me this feels very much Structure Theorem-ish. That is, we know that if $M$ is a f.g. module over a principal domain $R$ it can be decomposed as $$M = R^{\oplus s} \oplus R/(p_1^{\alpha_{11}}) \oplus ... \oplus R/(p_1^{\alpha_{1r_1}}) \oplus ... \oplus R/(p_k^{\alpha_{k1}}) \oplus ... \oplus R/(p_k^{\alpha_{kr_k}}).$$
Then the localization of $M$ at a prime ideal $(p_i)$ is $R_{(p_i)}^{\oplus s} \oplus R_{(p_i)}/(p_i^{\alpha_{i1}})R_{(p_i)} \oplus ... \oplus R_{(p_i)}/(p_i^{\alpha_{ir_i}})R_{(p_i)}$.
So to me it seems that the necessary condition for the decomposition to work is
1. that the module is equal to its torsion submodule;
also it seems that we also have to require that
2. for each prime ideal $\mathfrak{p}$ in $R$ and each nonnegative integer $\alpha$ we have equality $R/\mathfrak{p}^\alpha = R_\mathfrak{p}/\mathfrak{p}^\alpha R_\mathfrak{p}$.

Under which conditions does the second assumption hold? Will this two conditions be sufficient for a desired decomposition to occur, not necessarily if $M$ is f.g. and $R$ is a PID? Under which conditions such decomposition is possible?
I would really appreciate any help or advice. Thank you in advance!
And I apologize if my question is flawed in some way. I tried to express my understanding of the problem as much as possible and I hope I haven't missed anything.
 A: Your condition $\textbf{2}$: $R/\mathfrak{p}^\alpha = R_\mathfrak{p}/\mathfrak{p}^\alpha R_\mathfrak{p}$ generally holds when $\mathfrak{p}$ is a maximal ideal of $R$. For if $r \text{ mod } \mathfrak{p}^\alpha$ is in the kernel of the natural map $R/\mathfrak{p}^\alpha \to R_\mathfrak{p}/\mathfrak{p}^\alpha R_\mathfrak{p}$, we have $sr \in \mathfrak{p}^\alpha$ for some $s \in R \setminus{\mathfrak{p}}$. Then $R = Rs+\mathfrak{p}^\alpha$, say $1 = us+v$ for suitable $u \in R$ and $v \in \mathfrak{p}^\alpha$, so that $r=usr+vr \in \mathfrak{p}^\alpha$. That is, $r \text{ mod } \mathfrak{p}^\alpha = 0$. And every $s \in R \setminus{\mathfrak{p}}$ is already invertible in $R/\mathfrak{p}^\alpha$, because $Rs+\mathfrak{p}^\alpha = R$. Hence $R/\mathfrak{p}^\alpha \twoheadrightarrow R_\mathfrak{p}/\mathfrak{p}^\alpha R_\mathfrak{p}$.
This may fail for prime ideals that are not maximal. E.g., let $R = k[X,Y,Z]/(XY-Y^2-Z^2)$, where $k$ is a field, and $\mathfrak{p} = (\overline{Y},\overline{Z})$. Then $\overline{X}\overline{Y} \in \mathfrak{p}^2$ while $\overline{X} \notin \mathfrak{p}$ and $\overline{Y} \in \mathfrak{p} \setminus{\mathfrak{p}^2}$. Thus $\overline{Y} \text{ mod } \mathfrak{p}^2$ becomes zero when localizing at $\mathfrak{p}$.
The natural map $f:M\to\bigoplus_{\mathfrak{p} \in \mathrm{Max}(R)} M_\mathfrak{p}$ is well defined iff each $x\in M$ is zero in $M_\mathfrak{p}$ for almost all maximal ideals $\mathfrak{p}$. That is, iff the annihilator $\mathrm{ann}_R(x)$ of each $x$ is contained in only finitely many maximal ideals of $R$.
If $f$ is well defined, it is injective, but not usually surjective. It is in the case of a finitely generated torsion module $M$ over a principal ideal domain $R$, for the reasons you give. But, given  any commutative ring $R$, the map $f$ will be an isomorphism for any $M$ of the form $\bigoplus_{\mathfrak{p} \in \mathrm{Max}(R)} N(\mathfrak{p})$, when each $N(\mathfrak{p})$ is an $R_{\mathfrak{p}}$-module with $R$-annihilator radical $\sqrt{\mathrm{ann}_R(N(\mathfrak{p}))} = \mathfrak{p}$. And such $M$ need not be f.g. or torsion, of course.
$\mathbb{Z}\left[\frac{1}{p}\right]=\mathbb{Z}_p=S^{-1}\mathbb{Z}$, where $S$ is the multiplicative system consisting of the powers of $p$. As $\mathbb{Z}\left[\frac{1}{p}\right]/\mathbb{Z}$ is a proper subset of $\mathbb{Q}/\mathbb{Z}$, it is therefore $\textbf{not}$ a localization of $\mathbb{Q}/\mathbb{Z}$. Indeed, $\mathbb{Q}/\mathbb{Z}$ is a divisible $\mathbb{Z}$-module, so it is equal to each of its localizations (ignoring the degenerate localization $0=S^{-1}\mathbb{Q}/\mathbb{Z}$, where $S=\{0\}$). Your decomposition of $\mathbb{Q}/\mathbb{Z}$ is correct, but not of the form discussed above.
