Wednesday, January 5, 2022

Re: translat using oscar framework

Hi,

You need to understand what are you doing,

Oscar documentation put it really simple.

First create a directory inside your project called i18n and locale

Then create a symbolic link to Oscar package so manage.py makemessages can find translatable strings. 

For the last step, you need to locate where Django Oscar is inside your hard drive.

One simple way to find python directory is opening a PowerShell or cmd and opening the python console.

import os
import sys
os.path.dirname(sys.executable) 

That gives you the python executable files path.

After navigate to it, go to Lib->site-packages

There you will find all the libraries installed, including django-oscar

Once you have all the data, open a PowerShell or cmd and make the symbolic link, in windows you can use a shortcut just using right click -> create a shortcut, then renaming the shortcut and placing it where documentation mention.

Last, run manage.py makemessages with the flags you need. 

Remember, you're dealing with python not with Django as programming language.

If you don't have idea of what I'm writing, start with a simpler project.

Regards

Julio Cojom


El mié., 5 de enero de 2022 3:14 p. m., frank lucky <friendzone2013@gmail.com> escribió:
hi thanks for you time i  use this

mklink /d %PATH_TO_OSCAR/oscar

but i get this error (oscar) PS C:\Users\faramarz\Desktop\uniqemug-os> mklink /d %PATH_TO_OSCAR/oscar
mklink : The term 'mklink' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of
the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ mklink /d %PATH_TO_OSCAR/oscar
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (mklink:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

On Tuesday, January 4, 2022 at 8:24:30 PM UTC+3:30 Kasper Laudrup wrote:
On 04/01/2022 09.50, frank lucky wrote:
>
> mkdir locale i18n
> ln -s $PATH_TO_OSCAR i18n/oscar
> ./manage.py makemessages --symlinks --locale=de
>
> how i do it in windows  i make  local and i18n forlder in root of
> peoject but
> secound line not working
>

First of all, it is much easier for someone to help you if you describe
the errors you are getting instead of simply writing "not working" and
expect people to guess what that might mean.

It is quite easy to see the issues with that line. In Windows
environment variables, at least in cmd.exe, are accessed with % instead
of $ so you need to change that to %PATH_TO_OSCAR. Of course, that
assumes that you actually have that variable in your environment somehow.

Also, Windows hasn't support symbolic links historically but since
Windows 2000 or so it should be possible to use the "mklink" command
instead of the "ln" Unix command:

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/mklink

Not sure it will work though and in general I would really recommend
using pretty much anything other than Windows. It will save you from
tons and tons of frustrations.

Kind regards.

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4a80758e-d6e9-4c4a-a4fc-043e31cb2c6cn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHRQUHnmbB-c_EDMdmobKi1c8syXhAb0i0%3DE1iu_fgffprRXyA%40mail.gmail.com.

No comments:

Post a Comment