Git Product home page Git Product logo

Comments (4)

ikresoft avatar ikresoft commented on May 21, 2024

I change this line of code in poutil.py:
if u'-' in lang:
_l,c = map(lambda x:x.lower(),lang.split(u'-'))
#add capitalize()
langs += (u'%s
%s' %(_l, c), u'%s%s' %(_l, c.upper()), u'%s%s' %(_l, _c.capitalize()), )

after this sr-Latin is working.

from django-rosetta.

mbi avatar mbi commented on May 21, 2024

@ikresoft I'm not sure, are you suggesting this is a bug in Rosetta or Django? All locale directories in Django have an underscore, regardless of whether the locale name (in settings.py) is defined with a dash (-) or an underscore (_).

from django-rosetta.

ikresoft avatar ikresoft commented on May 21, 2024

I am also confused, in django locale directories are underscored but in i18n for my country is sr-latn and that coresponds to sr_Latn directory in django, and only way rosseta works for me is this capitalize() function in poutil.py

from django-rosetta.

BakanovKirill avatar BakanovKirill commented on May 21, 2024

Same issues worked for me.

The problem is when Django sees languages, rosetta doesn't and vise versa for dashed languages as 'zh-cn', 'zh-tw'. (Django expects zh_CN, zh_TW)

Steps to fix:

  1. Rename created by rosetta directories to suit django, i .e. zh-cn - > zh_CN, zh-tw -> zh_TW
  2. Apply fix which is proposed by @ikresoft to poutil.py. This way rosetta still sees renamed dirs.

P.s. you can't just insert 'zh_CN' and 'zh_TW' into settings.py LANGUAGES list because these are invalid language codes.

from django-rosetta.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.