vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Miscellaneous Hacks - vB Global Translator - Multiply your indexed pages & put search traffic on autopilot (https://vborg.vbsupport.ru/showthread.php?t=217329)

NLP-er 07-03-2009 05:13 PM

Quote:

Originally Posted by NLP-er (Post 1841391)
Hello right now google translates non braking spaces to normal spaces what can damage some layouts. To change this behaviour edit vb Global Translator hook

and replace:
Code:

require_once("translate.php");
$output=callback($output);

to:
Code:

$output = str_replace("&nbsp;", "<&nbsp;>", $output);
require_once("translate.php");
$output=callback($output);
$output = str_replace("<&nbsp;>", "&nbsp;", $output);

Thanks :)

Because it was not included in official release once again I strongly reccomend to made this change and also execute those queries on DB:
Code:

delete from wt_cache_short where originaltext like '%&nbsp;%';
delete from wt_cache_medium where originaltext like '%&nbsp;%';
delete from wt_cache where originaltext like '%&nbsp;%';

Other wise it is possible that your cache will be populated by data like
&nbsp;X
&nbsp;&nbsp;X
&nbsp;&nbsp;&nbsp;X

So for same X translation you can have many data in DB. Making mentioned change makes it works faster, and DB is smaller. Also executing those queries on DB will remove all data like listed above and bellow, X will be translated again and after that work without dummy DB filling, and unnecessary querying google for translations. Also indexes should be smaller and faster because there is less common prefixes in originaltext.

Also in my forum many sites have translations like:
Posts: X &nbsp;Y

So now you have translations like i.e.
Posts: 1 &nbsp;213
Posts: 1 &nbsp;6
Posts: 2 &nbsp;213
Posts: 2 &nbsp;6
Posts: 1 &nbsp;100
Posts: 2 &nbsp;100
Posts: 3 &nbsp;100
Posts: 3 &nbsp;213
Posts: 3 &nbsp;6

After my changes you will have less translations. For mentioned examples it will be only:
Posts: 1
Posts: 2
Posts: 3
213
100
6

Once again - I advice those changes

CThiessen 07-03-2009 06:51 PM

Hi;
works pretty good:
Googel.de
Quote:

Ergebnisse 1 - 10 von ungef?hr 7.530 aus brasil-web.de f?r inurl:?hl=
Googel.com
Quote:

Ergebnisse 1 - 10 von ungef?hr 8.070 aus brasil-web.de f?r inurl:?hl=
And most of them are from the time before I add sitemap and "<if condition="(THIS_SCRIPT == 'showthread')">" to the page so Google follow the Links on its own.

Christian

motorola 07-03-2009 07:57 PM

Quote:

Originally Posted by NLP-er (Post 1842138)
Just open any page on your forum, on any browser go to page source and find:

<meta http-equiv="Content-Type" content="text/html; charset=THIS-IS-YOUR-ORIGINALENCODING" />

Ok,thanks.

And what I should add here.. from here,I dont understand,I know,noob question maybe

All the flags are on separate lines in alpha order, find your language and add <!-- to the start and --> to the end of the line.

eg; <!-- language flag code -->

<a rel="novbseo"href="<?php echo (strstr($_SERVER["VBSEO_URI"],'?hl='.@$_GET['hl'])) ? str_replace('?hl='.@$_GET['hl'], '', $_SERVER["VBSEO_URI"]) . '?hl=en' : str_replace('?hl='.@$_GET['hl'], '', $_SERVER["VBSEO_URI"]) . "?hl=en"; ?>"><img src="/flags/United States.gif" alt="English" border="0" /></a>

NLP-er 07-03-2009 08:08 PM

I notice that for some data cache is not used, translation is made again and again cache is populated. So there can be data duplication in DB. It is rare and didn't find out why yet (1 clue - working on that).

If you would like to check do you have data duplication in your cache execute those queries. Execute one by one - each one works on other cache table and tells you how many times and which data is duplicated (1st column duplication counter, 2nd for which originaltext, 3rd for which language):
Code:

select count(*) counter, originaltext, tl from wt_cache_short group by originaltext, tl having count(*) > 1 order by counter desc;

select count(*) counter, originaltext, tl from wt_cache_medium group by originaltext, tl having count(*) > 1 order by counter desc;

select count(*) counter, originaltext, tl from wt_cache group by originaltext, tl having count(*) > 1 order by counter desc;

If someone will find out some rule in those duplicated data it would be great :)


So till it will be solved you can just clear data duplications. I can share my queries to do that, but be aware that those can evaluating for some time and I had to connect by some mysql client on my comp, because by www client server was passing away before query finished it's job.

So if you want to delete data duplication first need to create 2 tables for temporary data:
Code:

CREATE TABLE saver (
id INT,
tl VARCHAR(10),
originaltext VARCHAR(65000)
) ENGINE = MYISAM, CHARACTER SET utf8 COLLATE utf8_general_ci;

CREATE TABLE cleaner (
id INT
) ENGINE = MYISAM, CHARACTER SET utf8 COLLATE utf8_general_ci;

And when you have those you can execute clearing quereies - note those will leave first translation in your database and only remove next translatioss for same text and language:
Code:

delete from cleaner;
delete from saver;
insert into saver (SELECT min(id) as id, tl, originaltext from wt_cache_short group by originaltext,tl having count(*) > 1);
insert into cleaner (SELECT id from wt_cache_short where (originaltext, tl) in (SELECT originaltext, tl from saver) and id not in (SELECT id from saver));
DELETE FROM wt_cache_short USING wt_cache_short INNER JOIN cleaner ON wt_cache_short.id = cleaner.id;

delete from cleaner;
delete from saver;
insert into saver (SELECT min(id) as id, tl, originaltext from wt_cache_medium group by originaltext,tl having count(*) > 1);
insert into cleaner (SELECT id from wt_cache_medium where (originaltext, tl) in (SELECT originaltext, tl from saver) and id not in (SELECT id from saver));
DELETE FROM wt_cache_medium USING wt_cache_medium INNER JOIN cleaner ON wt_cache_medium.id = cleaner.id;

delete from cleaner;
delete from saver;
insert into saver (SELECT min(id) as id, tl, originaltext from wt_cache group by originaltext,tl having count(*) > 1);
insert into cleaner (SELECT id from wt_cache where (originaltext, tl) in (SELECT originaltext, tl from saver) and id not in (SELECT id from saver));
DELETE FROM wt_cache USING wt_cache INNER JOIN cleaner ON wt_cache.id = cleaner.id;


NLP-er 07-03-2009 08:12 PM

Quote:

Originally Posted by motorola (Post 1842311)
Ok,thanks.

And what I should add here.. from here,I dont understand,I know,noob question maybe

All the flags are on separate lines in alpha order, find your language and add <!-- to the start and --> to the end of the line.

eg; <!-- language flag code -->

<a rel="novbseo"href="<?php echo (strstr($_SERVER["VBSEO_URI"],'?hl='.@$_GET['hl'])) ? str_replace('?hl='.@$_GET['hl'], '', $_SERVER["VBSEO_URI"]) . '?hl=en' : str_replace('?hl='.@$_GET['hl'], '', $_SERVER["VBSEO_URI"]) . "?hl=en"; ?>"><img src="/flags/United States.gif" alt="English" border="0" /></a>

Just remove whole line with your language flag. Same result.

motorola 07-03-2009 08:40 PM

My forum dont load now,I see just a blank page,what happens?

LE: I found if I upload file translateflags.php forum doesnt load anymore,if I delete the file from the server it works.

TheLastSuperman 07-04-2009 12:14 AM

Quote:

Originally Posted by Dave Hybrid (Post 1840265)
Exactly, would you delete normal posts because your DB got a big big?

No, you'd keep them and upgrade the server if needed, so what's the difference... lol.

People worried about gaining too much content, that's a new one he he.

Not really, I help so many you would be surprised now think about all the ways this can sneak up on someone besides a post saying be careful of what might happen never hurts and is always rather helpful to those who are not even as far along in regards to vB as you are ;). You don't have to like what I say or agree with it based on your knowledge of vB but I have ran into many occasions where this would have made a difference and not for the positive so as long as others are aware IF they don't take the time to know then they might learn soon enough you see why I posted now?

Thanks!

S-MAN

Dave Hybrid 07-04-2009 10:44 AM

v2.3a Official Release

* Small fix to avoid translation of non braking spaces to normal spaces

To upgrade;

find in Global Translator Plugin:
Code:

require_once("translate.php");
$output=callback($output);

replace:
Code:

$output = str_replace("&nbsp;", "<&nbsp;>", $output);
require_once("translate.php");
$output=callback($output);
$output = str_replace("<&nbsp;>", "&nbsp;", $output);

Run this DB query:

Code:

delete from wt_cache_short where originaltext like '%&nbsp;%';
delete from wt_cache_medium where originaltext like '%&nbsp;%';
delete from wt_cache where originaltext like '%&nbsp;%';

Then optimize all 3 tables to remove overhead.

LI_Pets 07-04-2009 12:23 PM

Been watching this develop, so just one tweak is needed for vBseo?

How many languages will be used all 28?

Or do I chose them?

da_judge 07-04-2009 01:06 PM

Great addition, but im getting this problem

Installed yesterday... and i understand its got loads pages to translate...

If i translate home page... works fine... but if i try a forum or forum page all i get is

(French One)

Forum spécifié non valide. Si vous avez suivi un lien valide, s'il vous plaît aviser le administrateur

Translates into

Not valid specified forum. If you followed a link validates, please to notify the administrator

Is it a case of just waiting or is there a problem.... its been installed near 20 hours so far

Cheers


All times are GMT. The time now is 07:44 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01792 seconds
  • Memory Usage 1,767KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_code_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete