{"id":17543119,"url":"https://github.com/zzzsochi/trans","last_synced_at":"2025-04-23T23:48:48.749Z","repository":{"id":1943728,"uuid":"2873235","full_name":"zzzsochi/trans","owner":"zzzsochi","description":"National characters transcription module.","archived":false,"fork":false,"pushed_at":"2018-11-09T07:21:18.000Z","size":57,"stargazers_count":23,"open_issues_count":2,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-23T23:48:42.560Z","etag":null,"topics":["translit","transliterate","transliteration","transliterator","utf8"],"latest_commit_sha":null,"homepage":"http://www.python.org/pypi/trans/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zzzsochi.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-11-29T07:15:24.000Z","updated_at":"2025-02-18T12:52:43.000Z","dependencies_parsed_at":"2022-07-08T02:10:46.962Z","dependency_job_id":null,"html_url":"https://github.com/zzzsochi/trans","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzzsochi%2Ftrans","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzzsochi%2Ftrans/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzzsochi%2Ftrans/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzzsochi%2Ftrans/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zzzsochi","download_url":"https://codeload.github.com/zzzsochi/trans/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250535107,"owners_count":21446506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["translit","transliterate","transliteration","transliterator","utf8"],"created_at":"2024-10-21T00:22:55.343Z","updated_at":"2025-04-23T23:48:48.721Z","avatar_url":"https://github.com/zzzsochi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"====================\nThe **trans** module\n====================\n\nThis module translates national characters into similar sounding\nlatin characters (transliteration).\nAt the moment, Czech, Greek, Latvian, Polish, Turkish, Russian, Ukrainian,\nKazakh and Farsi alphabets are supported (it covers 99% of needs).\n\n.. contents::\n\nSimple usage\n------------\nIt's very easy to use\n~~~~~~~~~~~~~~~~~~~~~\n\nPython 3:\n\n  \u003e\u003e\u003e from trans import trans\n  \u003e\u003e\u003e trans('Привет, Мир!')\n\nPython 2:\n\n  \u003e\u003e\u003e import trans\n  \u003e\u003e\u003e u'Привет, Мир!'.encode('trans')\n  u'Privet, Mir!'\n  \u003e\u003e\u003e trans.trans(u'Привет, Мир!')\n  u'Privet, Mir!'\n\nWork only with unicode strings\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n  \u003e\u003e\u003e 'Hello World!'.encode('trans')\n  Traceback (most recent call last):\n      ...\n  TypeError: trans codec support only unicode string, \u003ctype 'str'\u003e given.\n\nThis is readability\n~~~~~~~~~~~~~~~~~~~\n  \u003e\u003e\u003e s = u'''\\\n  ...    -- Раскудрить твою через коромысло в бога душу мать\n  ...             триста тысяч раз едрену вошь тебе в крыло\n  ...             и кактус в глотку! -- взревел разъяренный Никодим.\n  ...    -- Аминь, -- робко добавил из склепа папа Пий.\n  ...                 (c) Г. Л. Олди, \"Сказки дедушки вампира\".'''\n  \u003e\u003e\u003e\n  \u003e\u003e\u003e print s.encode('trans')\n     -- Raskudrit tvoyu cherez koromyslo v boga dushu mat\n              trista tysyach raz edrenu vosh tebe v krylo\n              i kaktus v glotku! -- vzrevel razyarennyy Nikodim.\n     -- Amin, -- robko dobavil iz sklepa papa Piy.\n                  (c) G. L. Oldi, \"Skazki dedushki vampira\".\n\nTable \"**slug**\"\n~~~~~~~~~~~~~~~~\nUse the table \"slug\", leaving only the Latin characters, digits and underscores:\n\n  \u003e\u003e\u003e print u'1 2 3 4 5 \\n6 7 8 9 0'.encode('trans')\n  1 2 3 4 5\n  6 7 8 9 0\n  \u003e\u003e\u003e print u'1 2 3 4 5 \\n6 7 8 9 0'.encode('trans/slug')\n  1_2_3_4_5__6_7_8_9_0\n  \u003e\u003e\u003e s.encode('trans/slug')[-42:-1]\n  u'_c__G__L__Oldi___Skazki_dedushki_vampira_'\n\nTable \"**id**\"\n~~~~~~~~~~~~~~\nTable **id** is deprecated and renamed to **slug**.\nOld name also available, but not recommended.\n\nDefine user tables\n------------------\nSimple variant\n~~~~~~~~~~~~~~\n  \u003e\u003e\u003e u'1 2 3 4 5 6 7 8 9 0'.encode('trans/my')\n  Traceback (most recent call last):\n      ...\n  ValueError: Table \"my\" not found in tables!\n  \u003e\u003e\u003e trans.tables['my'] = {u'1': u'A', u'2': u'B'};\n  \u003e\u003e\u003e u'1 2 3 4 5 6 7 8 9 0'.encode('trans/my')\n  u'A_B________________'\n  \u003e\u003e\u003e\n\nA little harder\n~~~~~~~~~~~~~~~\nTable can consist of two parts - the map of diphthongs and the map of characters.\nDiphthongs are processed first by simple replacement in the substring.\nThen each character of the received string is replaced according to the map of\ncharacters. If character is absent in the map of characters, key **None** are checked.\nIf key **None** is not present, the default character **u'_'** is used.\n\n\n  \u003e\u003e\u003e diphthongs = {u'11': u'AA', u'22': u'BB'}\n  \u003e\u003e\u003e characters = {u'a': u'z', u'b': u'y', u'c': u'x', None: u'-',\n  ...               u'A': u'A', u'B': u'B'}  # See below...\n  \u003e\u003e\u003e trans.tables['test'] = (diphthongs, characters)\n  \u003e\u003e\u003e u'11abc22cbaCC'.encode('trans/test')\n  u'AAzyxBBxyz--'\n\n**The characters are created by processing of diphthongs also processed\nby the map of the symbols:**\n\n  \u003e\u003e\u003e diphthongs = {u'11': u'AA', u'22': u'BB'}\n  \u003e\u003e\u003e characters = {u'a': u'z', u'b': u'y', u'c': u'x', None: u'-'}\n  \u003e\u003e\u003e trans.tables['test'] = (diphthongs, characters)\n  \u003e\u003e\u003e u'11abc22cbaCC'.encode('trans/test')\n  u'--zyx--xyz--'\n\nWithout the diphthongs\n~~~~~~~~~~~~~~~~~~~~~~\nThese two tables are equivalent:\n\n  \u003e\u003e\u003e characters = {u'a': u'z', u'b': u'y', u'c': u'x', None: u'-'}\n  \u003e\u003e\u003e trans.tables['t1'] = characters\n  \u003e\u003e\u003e trans.tables['t2'] = ({}, characters)\n  \u003e\u003e\u003e u'11abc22cbaCC'.encode('trans/t1') == u'11abc22cbaCC'.encode('trans/t2')\n  True\n\nChangeLog\n---------\n\n2.1 2016-09-19\n\n    * Add Farsi alphabet (thx rodgar-nvkz)\n    * Use pytest\n    * Some code style refactoring\n\n\n2.0 2013-04-01\n\n    * Python 3 support\n    * class Trans for create different tables spaces\n\n1.5 2012-09-12\n\n    * Add support of kazakh alphabet.\n\n1.4 2011-11-29\n\n    * Change license to BSD.\n\n1.3 2010-05-18\n\n    * Table \"id\" renamed to \"slug\". Old name also available.\n    * Some speed optimizations (thx to AndyLegkiy \u003candy.legkiy at gmail.com\u003e).\n\n1.2 2010-01-10\n\n    * First public release.\n    * Translate documentation to English.\n\n\n\nFinally\n-------\n+ *Special thanks to Yuri Yurevich aka j2a for the kick in the right direction.*\n    - http://python.su/forum/viewtopic.php?pid=28965\n    - http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/media/js/urlify.js\n+ *I ask forgiveness for my bad English. I promise to be corrected.*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzzzsochi%2Ftrans","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzzzsochi%2Ftrans","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzzzsochi%2Ftrans/lists"}