The ability to use photonic quasiparticles to control electromagnetic energy far below the diffraction limit is a defining paradigm in nanophotonics. An important recent development in this field is the measurement and manipulation of extremely confined phonon-polariton modes in polar dielectrics such as silicon carbide and hexagonal boron nitride, which pave the way for nanophotonics and extreme light-matter interactions in the mid-IR to THz frequency range. To further advance this promising field, it is of great interest to predict the optical response of recently discovered and yet-to-be-synthesized polaritonic materials alike. Here we develop a unified framework based on quantum linear response theory to calculate the spatially non-local dielectric function of a polar lattice in arbitrary dimensions. In the case of a three-dimensional bulk material, the spatially local limit of our calculation reproduces standard results for the dielectric response of a polar lattice. Using this framework, we provide ab initio calculations of the dielectric permittivity of important bulk polar dielectrics such as silicon carbide and hexagonal boron nitride in good agreement with experiments. From the ab initio theory, we are able to develop a microscopic understanding of which phonon modes contribute to each component of the dielectric function, as well as predict features in the dielectric function that are a result of weak TO phonons. This formalism also identifies regime(s) where quantum nonlocal effects may correct the phonon polariton dispersion, extremely relevant in recent atomic-scale experiments which confine electromagnetic fields to the scale of 1~nm. Finally, our work points the way towards first principles descriptions of the effect of interface phonons, phonon strong coupling, and chiral phonons on the properties of phonon polaritons.