S
S
sshz2012-04-11 16:35:30
PHP
sshz, 2012-04-11 16:35:30

Base of cities in the right case?

I would like something strange, namely, to write on the site “in Moscow”, “in St. Petersburg”, etc. depending on the city of the user visiting the site.
Maybe there is somewhere a database of Russian cities in different cases? Or maybe someone has?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
Sekira, 2012-04-11
@sshz

3 Google result:

M
mmjurov, 2012-04-11
@mmjurov

This is how you can still cling to the edge on the fly, well, or write a script, download the necessary ones:
export.yandex.ru/inflect.xml?name=%D0%91%D0%B0%D1%80%D0%BD%D0%B0 %D1%83%D0%BB

B
BlackSwan, 2012-04-12
@BlackSwan

Isn't it easier to script the simple rules of the Russian language?
For example, like this:
1) Moscow a => Moscow e
2) Petrburg g => Petrburg So
, offhand, if the name ends in a vowel or a soft sign, we change it to the letter e.

D
Dmitry, 2012-04-13
@Neir0

There is a morphological library for PHP, phpmorphy, I don't remember. Accordingly, through it, you can put the city in the desired case.

N
nikhop, 2018-01-09
@nikhop

Um... Isn't it easier?
List of cities in Russia with a population of more than 50 thousand in all cases: www.electric43.ru/spisok-gorodov-vo-vseh-padezhah

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question