Lorentz invariance of the electric charge. (Gravitation and Cosmology by Weinberg) I was reading the Special Relativity chapter from Weinberg's Gravitation and Cosmology book and could use some help to prove that charge is a Lorentz scalar.

6 Currents and Densities

Suppose that we have a system of particles with position $\,\mathbf x_{n}(t)\,$ and charges $\,e_{n}$. The current and charge densities are usually defined by
\begin{align}
\mathbf J(\mathbf x,t) & \boldsymbol{\equiv} \sum\limits_{n} e_{n}\delta^3\left[\mathbf x\boldsymbol{-}\mathbf x_{n}(t)\right]\dfrac{\mathrm d \mathbf x_{n}(t)}{\mathrm d t}
\tag{2.6.1}\label{2.6.1}\\
\boldsymbol{\varepsilon}(\mathbf x,t) & \boldsymbol{\equiv} \sum \limits_{n} e_{n}\delta^3\left[\mathbf x\boldsymbol{-}\mathbf x_{n}(t)\right]
\tag{2.6.2}\label{2.6.2} 
\end{align}
Here $\,\delta^3\,$ is the Dirac delta function, defined by the statement that for any smooth function $\,f(x)$,
\begin{equation}
\int\mathrm d^3 x f(\mathbf x)\delta^3\left(\mathbf x\boldsymbol{-}\mathbf y\right) \boldsymbol{=}f(\mathbf y)
\nonumber
\end{equation}
We can unite $\,\mathbf J\,$ and $\,\boldsymbol{\varepsilon}\,$ into a four-vector $\,J^{\alpha}\,$ by setting
\begin{equation}
J^{0}\boldsymbol{\equiv}\boldsymbol{\varepsilon}
\tag{2.6.3}\label{2.6.3}
\end{equation}
that is
\begin{equation}
J^{\alpha}(x)  \boldsymbol{\equiv} \sum\limits_{n} e_{n}\delta^3\left[\mathbf x\boldsymbol{-}\mathbf x_{n}(t)\right]\dfrac{\mathrm d x^{\alpha}_{n}(t)}{\mathrm d t}
\tag{2.6.4}\label{2.6.4}
\end{equation}

........

........

We also note that in four-dimensional language
\begin{equation}
\dfrac{\partial}{\partial x^{\alpha}}J^{\alpha}(x)\boldsymbol{=}0
\tag{2.6.6}\label{2.6.6}
\end{equation}
The Lorentz invariance of this statement is evident.

Whenever any current $\,J^{\alpha}(x)\,$ satisfies the invariant conservation law \eqref{2.6.6}, we can form a total charge
\begin{equation}
Q\boldsymbol{\equiv} \int\mathrm d^3 x J^{0}(x) 
\tag{2.6.7}\label{2.6.7}
\end{equation}
This quantity is time-independent, because \eqref{2.6.6} and Gauss's theorem give
\begin{equation}
\dfrac{\mathrm d Q}{\mathrm d t}\boldsymbol{=} \int\mathrm d^3 x \dfrac{\partial}{\partial x^{0}} J^{0}(x)\boldsymbol{=}\boldsymbol{-} \int\mathrm d^3 x \boldsymbol{\nabla\cdot}\mathbf J(x) \boldsymbol{=} 0 
\nonumber
\end{equation}
If $\,J^{\alpha}(x)\,$ is a four-vector, $\,Q\,$ is not only constant but a scalar. To see this, write $\,Q\,$ as
\begin{equation}
Q\boldsymbol{=}\int \mathrm d^4 x J^{\alpha}(x)\partial_{\alpha}\theta(n_{\beta}x^{\beta})
\tag{2.6.8}\label{2.6.8}
\end{equation}
where $\,\theta\,$ is the step function
\begin{equation}
\theta(s)\boldsymbol{=}
\begin{cases}
1\quad s>0\\
0\quad s<0 
\end{cases}
\nonumber
\end{equation}
and $\,n_{\lambda}\,$ is defined by
\begin{equation}
n_{1}\boldsymbol{\equiv}n_{2}\boldsymbol{\equiv}n_{3}\boldsymbol{\equiv}0,\quad n_{0}\boldsymbol{\equiv}\boldsymbol{+}1
\nonumber
\end{equation}
The effect of a Lorentz transformation on  $\,Q\,$ is then evidently simply to change  $\,n\,$:
\begin{equation}
Q'\boldsymbol{=}\int \mathrm d^4 x J^{\alpha}(x)\partial_{\alpha}\theta(n'_{\beta}x^{\beta})
\nonumber
\end{equation}
\begin{equation}
n'_{\beta}\boldsymbol{\equiv}\Lambda^{\gamma}_{\hphantom{\gamma}\beta}n_{\gamma}
\nonumber
\end{equation}
and using \eqref{2.6.6}, the change in $\,Q\,$ is then
\begin{equation}
Q'\boldsymbol{-}Q\boldsymbol{=}\int \mathrm d^4 x \partial_{\alpha} \left[J^{\alpha}(x)\{\theta(n'_{\beta}x^{\beta})\boldsymbol{-}\theta(n_{\beta}x^{\beta})\}\right]
\nonumber
\end{equation}
The current $\,J^{\alpha}(x)\,$ can be presumed to vanish if $\,\vert\mathbf x\vert\longrightarrow \boldsymbol{+}\infty\,$ with $\,t\,$ fixed.Whereas the function $θ(n′_β x^β)−θ(n_β x^β)$ vanishes as |t|⟶+∞ with x fixed. Hence we can apply the four-dimensional Gauss theorem, and find $\,Q'\boldsymbol{-}Q\boldsymbol{=}0$; that is,  $\,Q\,$ is a scalar.
(For the current density $\,J^{0}\,$ defined by \eqref{2.6.2} the charge \eqref{2.6.7} is
\begin{equation}
Q\boldsymbol{=}\sum\limits_{n}e_{n}
\nonumber
\end{equation}
which of course is a constant scalar; however, in dealing with the charge and
current distributions of extended particles it is important to realize that \eqref{2.6.7} defines a time-independent scalar for any conserved four-vector $\,J^{\alpha}$.)

$=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!$
I have trouble understanding the part where it says "the effect of a Lorentz transformation on Q is simply to change $n$." I know the dot product between a covariant and a contravariant vector is a Lorentz scalar. So the dot product of current density and partial derivative function is a Lorentz scalar. But why change $n$ to $n'$? The term inside the step function is also in the form of a dot product between a covariant and contravariant vector. so shouldn't it be a Lorentz scalar?
If the volume element is also invariant can't we say right away that charge is a Lorentz scalar?
{And in the equation of $Q'-Q$, how did the current density vector go inside the partial derivative function?.}
 A: Let us denote $\{x^\alpha\}$ as the original coordinates and $\{x'^\alpha\}$ as the transformed coordinates. There are 4 quantities that undergo Lorentz transformation in total. First is the volume element $d^4x$. It transforms as
$$d^4y=Jd^4x,$$ where $J=\sqrt{g/g'}$ is the Jacobian of the transformation and $g$, as well as $g'$, denote the determinant of the metric tensor in both coordinate systems respectively. In Special Relativity (SR), both determinants are $-1$, since the metric tensor is always the Minkowski metric in all Lorentz frames. So the 4-volume $d^4x$ is a Lorentz scalar. 
The second quantity and the third quantities are the 4-current vector and the partial derivative respectively. You are correct in that the product of these two is a Lorentz scalar, so we need not to change them. The final quantity is the variable in the Heaviside step function $\theta(x)$. Expanding the expression $\theta(n_{\beta}x^{\beta})$ gives $\theta(t)$ and under a Lorentz transformation, the Heaviside step function becomes $\theta(at'+bx')$ for some scalars $a$ and $b$. Since the same variable $x$ is used in the expression in $Q'$, then we can express $a t'+b x'$ as $n'_\beta x^\beta.$ in which the variable $x$ now denotes the transformed coordinates.
The 4-current vector can be inserted inside the partial derivative in virtue of expression $(2.2.6)$. Using chain rule, we have
$$\partial_\alpha J^\alpha\{\theta(n'_\beta x^\beta)-\theta(n_\beta x^\beta)\}+J^\alpha\partial_\alpha\{\theta(n'_\beta x^\beta)-\theta(n_\beta x^\beta)\},$$ where by $eq.(2.2.6),$ the left hand side vanishes and we recover the original expression for $Q$.
The term in the Heaviside step function is not a dot product between a contravariant vector and a covariant vector as $n_\beta$ is certainly not a vector. It is just a convenient way to write up the expression. Finally, it might be instructive to see how the $eq.(2.6.8)$ can be converted to the usual expression for electric charge $Q=\int d^3xJ^0(x).$ Expanding the sum in step function $\theta$ gives $$Q=\int d^4xJ^\alpha\partial_\alpha\theta(t).$$ Using $\frac{d\theta}{dx}=\delta(x)$, we have
$$Q=\int d^4x J^0\delta(t)=\int d^3x J^0\int dt\delta (t)=\int d^3 J^0.$$
