{"action":"closed","issue":{"url":"https://api.github.com/repos/Ragil/Communicate-Indonesia/issues/3","labels_url":"https://api.github.com/repos/Ragil/Communicate-Indonesia/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/Ragil/Communicate-Indonesia/issues/3/comments","events_url":"https://api.github.com/repos/Ragil/Communicate-Indonesia/issues/3/events","html_url":"https://github.com/Ragil/Communicate-Indonesia/issues/3","id":97868969,"number":3,"title":"SSADi18n - Super simple and dumb internationalization module","user":{"login":"Ragil","id":369286,"avatar_url":"https://avatars.githubusercontent.com/u/369286?v=3","gravatar_id":"","url":"https://api.github.com/users/Ragil","html_url":"https://github.com/Ragil","followers_url":"https://api.github.com/users/Ragil/followers","following_url":"https://api.github.com/users/Ragil/following{/other_user}","gists_url":"https://api.github.com/users/Ragil/gists{/gist_id}","starred_url":"https://api.github.com/users/Ragil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ragil/subscriptions","organizations_url":"https://api.github.com/users/Ragil/orgs","repos_url":"https://api.github.com/users/Ragil/repos","events_url":"https://api.github.com/users/Ragil/events{/privacy}","received_events_url":"https://api.github.com/users/Ragil/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-29T06:17:35Z","updated_at":"2015-08-02T22:24:07Z","closed_at":"2015-08-02T22:24:07Z","body":"Since we only care about two languages, we can get away with implementing a very simple internationalization module for the application.\r\n\r\nIt shall live in\r\n```\r\napp/i18n/__init__.py\r\n```\r\n\r\nusage:\r\n```\r\nfrom app.i18n import _\r\n\r\n# set the domain based on the user's default language\r\n# we can probably skip this part and default the domain to 'in'\r\n_.domain('in')\r\n\r\n\r\ntype = _('potato') # kentang \r\nsms = _('{} {} planted') # '{} {} tertanam' \r\n```\r\n\r\nAll strings in the application will be in English and passed to i18n. i18n will convert it to Indonesian. Since we only care about two languages, we can simply implement i18n using a map. eg:\r\n\r\n```\r\nclass i18n(object):\r\n  in = {\r\n    'potato' : 'kentang',\r\n    '{} {} planted' : '{} {} tertanam'\r\n  }\r\n\r\n  def __call__(str):\r\n    return self.in[str]\r\n```"}}