|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Missed translation in sub menus?Hi,
I just found, after svn up in trunk, that the strings in sub menus are not translated under Reports->Graphs->.... and Tools->Database Repair... The translated strings are in the *.po file. /Peter ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gramps-devel mailing list Gramps-devel@... https://lists.sourceforge.net/lists/listinfo/gramps-devel |
|
|
Re: Missed translation in sub menus?Doug, this should be due to the changes in _ on registering the plugins.
Benny 2009/11/4 Peter Landgren <peter.talken@...>: > Hi, > I just found, after svn up in trunk, that the strings in sub menus are not translated under > Reports->Graphs->.... and Tools->Database Repair... > > The translated strings are in the *.po file. > > /Peter > > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Gramps-devel mailing list > Gramps-devel@... > https://lists.sourceforge.net/lists/listinfo/gramps-devel > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gramps-devel mailing list Gramps-devel@... https://lists.sourceforge.net/lists/listinfo/gramps-devel |
|
|
Re: Missed translation in sub menus?On Wed, Nov 4, 2009 at 4:47 AM, Benny Malengier
<benny.malengier@...> wrote: > Doug, this should be due to the changes in _ on registering the plugins. This sounds like exactly what would happen if my change is not working correctly. Maybe Brian can help me understand why this isn't working. I'm attempting to use the fallback mechanism of the gettext.translation class, and that does seem to work fine. The problem (I think) is that I first have to get a translation for the current language locale, say French. Here is the relevant code in TransUtils: LANG = locale.getlocale()[0] or "en" path = os.path.dirname(os.path.abspath(filename)) trans = Translator(LANG) try: fallback = gettext.translation(domain, os.path.join(path, "locale"), languages=[LANG]) trans.trans.add_fallback(fallback) except: pass I think the Translator("fr") is failing to get a French locale, and thus the menu items are in English. The plugin will be fine, if it uses _ = gettext.gettext or if it has its own locale system. I'll continue to look at this but if anyone has ideas, please let me know. -Doug > Benny > > 2009/11/4 Peter Landgren <peter.talken@...>: >> Hi, >> I just found, after svn up in trunk, that the strings in sub menus are not translated under >> Reports->Graphs->.... and Tools->Database Repair... >> >> The translated strings are in the *.po file. >> >> /Peter >> >> >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day >> trial. Simplify your report design, integration and deployment - and focus on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> Gramps-devel mailing list >> Gramps-devel@... >> https://lists.sourceforge.net/lists/listinfo/gramps-devel >> > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gramps-devel mailing list Gramps-devel@... https://lists.sourceforge.net/lists/listinfo/gramps-devel |
|
|
Re: Missed translation in sub menus?Doug,
> This sounds like exactly what would happen if my change is > not working > correctly. > > Maybe Brian can help me understand why this isn't working. > I'm > attempting to use the fallback mechanism of the > gettext.translation > class, and that does seem to work fine. The problem (I > think) is that > I first have to get a translation for the current language > locale, say > French. Here is the relevant code in TransUtils: > > LANG = locale.getlocale()[0] or "en" > path = > os.path.dirname(os.path.abspath(filename)) > trans = Translator(LANG) > try: > fallback = > gettext.translation(domain, > > > os.path.join(path, > "locale"), > > > languages=[LANG]) > > trans.trans.add_fallback(fallback) > except: > pass > > I think the Translator("fr") is failing to get a French > locale, and > thus the menu items are in English. The plugin will be > fine, if it > uses _ = gettext.gettext or if it has its own locale > system. > > I'll continue to look at this but if anyone has ideas, > please let me know. On my system (Ubuntu Karmic), I only have the en_US locale installed on the system. As such, when I start Gramps with "LANG=fr; gramps.py", "locale.getlocale()" returns (None, None). So get_addon_translator() fails to return the proper translator. You can make get_addon_translator() more intelligent by using this logic: LANG = locale.getlocale()[0] if not LANG and "LANG" in os.environ: LANG = os.environ["LANG"] else: LANG = "en" This code makes it work properly on my system. However, in the future, we might find different scenarios on different systems that still fail. I predict that you will perpetually have trouble making this work properly. For example, on Windows, local.getlocale()[0] returns "English_UnitedStates" and similar strings for other locales. Will your translator work when that is passed in? I'm still not exactly sure what's going on here since the strings that are not being translated come from tools.gpr.py. How is the .grp file being affected by get_addon_translator()? Some other general comments about get_addon_translator() 1) You are importing "locale" in the function. Please move all imports to the top of the file. 2) LANG does not need to be all capitalized. All CAPS is reserved for constants at the top of the file. 3) You should specify an exception type in your try/except statement. ~Brian ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gramps-devel mailing list Gramps-devel@... https://lists.sourceforge.net/lists/listinfo/gramps-devel |
|
|
Re: Missed translation in sub menus?> On Wed, Nov 4, 2009 at 4:47 AM, Benny Malengier
If I enable the error check in TransUtils line 102-104 I get:
> > <benny.malengier@...> wrote: > > Doug, this should be due to the changes in _ on registering the plugins. > > This sounds like exactly what would happen if my change is not working > correctly. > > Maybe Brian can help me understand why this isn't working. I'm > attempting to use the fallback mechanism of the gettext.translation > class, and that does seem to work fine. The problem (I think) is that > I first have to get a translation for the current language locale, say > French. Here is the relevant code in TransUtils: > > LANG = locale.getlocale()[0] or "en" > path = os.path.dirname(os.path.abspath(filename)) > trans = Translator(LANG) > try: > fallback = gettext.translation(domain, > os.path.join(path, "locale"), > languages=[LANG]) > trans.trans.add_fallback(fallback) > except: > pass > > I think the Translator("fr") is failing to get a French locale, and > thus the menu items are in English. The plugin will be fine, if it > uses _ = gettext.gettext or if it has its own locale system. > > I'll continue to look at this but if anyone has ideas, please let me know. > > -Doug : WARN: can't add local '/home/peter/svn/GRAMPSTRUNK/trunk/src/plugins/export/export.gpr.py' addon translation for 'sv_SE'. /Peter ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gramps-devel mailing list Gramps-devel@... https://lists.sourceforge.net/lists/listinfo/gramps-devel |
|
|
Re: Missed translation in sub menus? (one more thing)> On my system (Ubuntu Karmic), I only have the en_US locale
> installed on the system. As such, when I start Gramps with > "LANG=fr; gramps.py", "locale.getlocale()" returns (None, > None). So get_addon_translator() fails to return the proper > translator. You can make get_addon_translator() more > intelligent by using this logic: > > LANG = locale.getlocale()[0] > if not LANG and "LANG" in os.environ: > LANG = os.environ["LANG"] > else: > LANG = "en" > > This code makes it work properly on my system. However, in > the future, we might find different scenarios on different > systems that still fail. I predict that you will perpetually > have trouble making this work properly. For example, on > Windows, local.getlocale()[0] returns "English_UnitedStates" > and similar strings for other locales. Will your translator > work when that is passed in? So, I just tried something. If you don't specify the language, the gettext system figures it out for you. fallback = gettext.translation(domain, os.path.join(path, "locale")) On my system, if I don't pass in the languages parameter, it works every time. That's probably the best way to go. ~Brian ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gramps-devel mailing list Gramps-devel@... https://lists.sourceforge.net/lists/listinfo/gramps-devel |
|
|
Re: Missed translation in sub menus? (one more thing)On Wed, Nov 4, 2009 at 8:14 AM, Brian Matherly <brian@...> wrote:
>> On my system (Ubuntu Karmic), I only have the en_US locale >> installed on the system. As such, when I start Gramps with >> "LANG=fr; gramps.py", "locale.getlocale()" returns (None, >> None). So get_addon_translator() fails to return the proper >> translator. You can make get_addon_translator() more >> intelligent by using this logic: >> >> LANG = locale.getlocale()[0] >> if not LANG and "LANG" in os.environ: >> LANG = os.environ["LANG"] >> else: >> LANG = "en" >> >> This code makes it work properly on my system. However, in >> the future, we might find different scenarios on different >> systems that still fail. I predict that you will perpetually >> have trouble making this work properly. For example, on >> Windows, local.getlocale()[0] returns "English_UnitedStates" >> and similar strings for other locales. Will your translator >> work when that is passed in? > > So, I just tried something. If you don't specify the language, the gettext system figures it out for you. > > fallback = gettext.translation(domain, os.path.join(path, "locale")) > > On my system, if I don't pass in the languages parameter, it works every time. That's probably the best way to go. Brilliant! You're a genius and a scholar... look for an update later today... -Doug > ~Brian > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Gramps-devel mailing list > Gramps-devel@... > https://lists.sourceforge.net/lists/listinfo/gramps-devel > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gramps-devel mailing list Gramps-devel@... https://lists.sourceforge.net/lists/listinfo/gramps-devel |
| Free embeddable forum powered by Nabble | Forum Help |