Hallo,

Wie kan mij vertellen/uitleggen hoe ik onderstaande regel via een <?php langtrans ('Visitors online right now'); ?> of <?php echo langtransstr ('Visitors online right now'); ?> op dez manier langlookup|Visitors online right now|Bezoekers online| in b.v. een languane-nl.txt krijg

define('TEXT_VISITOR_ONLINE_NOW', 'Visitors online right now');

Vr groet,

Piet
Hoe sla je het op in het tekstbestand?
is een .php-file met een array niet gemakkelijker?
Dit is de php file waar het om gaat regels 306 t/m 379


<?php
error_reporting(E_ALL ^ E_NOTICE); // Report all errors except E_NOTICE warnings
ini_set('display_errors', 1); // turn error reporting on
//ini_set('log_errors', 1); // log errors
//ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); // where to log errors
/*

This settings file gets included in include-whos-online-header.php

Who's Online PHP Script by Mike Challis
Free PHP Scripts - www.642weather.com/weather/scripts.php
Download - www.642weather.com/weather/scripts/whos-online.zip
Live Demo - www.642weather.com/weather/whos-online.php
Contact Mike - www.642weather.com/weather/contact_us.php

Version: 2.25 - 01-Sep-2009 see changelog.txt for changes

You are free to use and modify the code

This php code provided "as is", and Long Beach Weather (Michael Challis)
disclaims any and all warranties, whether express or implied, including
(without limitation) any implied warranties of merchantability or
fitness for a particular purpose.

Copyright (C) 2008 Mike Challis (www.642weather.com/weather/contact_us.php)

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

// you must set these settings correctly for the script to function:

// this setting is to disable whos online for database maintenance
$C['disable_whos_online'] = 0;

// mysql database settings (you must already have a mysql database)
$C['dbhost'] = 'localhost'; // host
$C['dbname'] = ''; // database name
$C['dbuser'] = ''; // database user
$C['dbpass'] = ''; // database password

// you can define the table names
// this is handy if you have more than one web site sharing the same database
// then you can use a unique prefix for the table names.
define('TABLE_WHOS_ONLINE', 'whos_online');
define('TABLE_STATS', 'stats');
define('TABLE_GEO_UPDATE', 'geo_update');

// must match the name of your whose-online.php page
$C['filename_whos_online'] = 'whos-online.php';

// url to open when a IP address is clicked on
// download ip-to-country here: http://www.642weather.com/weather/ip-to-country.php
// http://www.642weather.com/weather/scripts/ip-to-country.zip
// http://www.yourwebsite.com/ip-to-country.php?action=check&ip=
// or use one of these free ip lookups
// http://www.showmyip.com/?ip=
// http://www.geo-location.com/cgi-bin/index.cgi?s=
$C['whois_url'] = 'http://www.geo-location.com/cgi-bin/index.cgi?s=';;

// open whois_url on a pop up?
$C['whois_url_popup'] = 0; // 1 enables, 0 disables

// enable host lookups for IP addresses
// (this will add an ISP hostname to the IP address link title and to the profile display)
// hostname lookups may sometimes cause a delay in web page loading, if that becomes the case, you can disable it
$C['enable_host_lookups'] = 1; // 1 enables, 0 disables

// enable location-plugin (shows country flags for visitors and stores location info)
// requires installing the location-plugin
// enabling this will cause an error if you have not installed the plugin!
$C['enable_location_plugin'] = 0; // 1 enables, 0 disables

// enable display of city, state next to country flag
// requires installing and enabling the location-plugin
$C['enable_state_display'] = 0; // 1 enables, 0 disables

// uncomment and set optional setting to set a directory where your GeoLiteCity.dat file is.
// For some users who want the GeoLiteCity.dat file in a different folder
// use server path, NOT URL!!
//$C['geolite_path'] = '/server/path/to/folder/'; // must be full path, always end with a slash
// note: if you use this setting, also edit wo-update.php and set this setting there also

///////////////////////////////////////////////////////
// next 5 settings used only when password protection is turned off:
///////////////////////////////////////////////////////

// allow visitors to set autorefresh on the whose-online page
$C['allow_refresh'] = 0; // 1 enables, 0 disables

// allow visitors to select profile display on the whose-online page
$C['allow_profile_display'] = 0; // 1 enables, 0 disables

// allow visitors to view ip addresses on the whose-online page
$C['allow_ip_display'] = 0; // 1 enables, 0 disables

// allow visitors to view last url on the whose-online page
// Your web site privacy policy might not permit you to display site visitor's IP addresses
// .. see known issues in the readme.txt
$C['allow_last_url_display'] = 0; // 1 enables, 0 disables

// allow visitors to view referer on the whose-online page
$C['allow_referer_display'] = 0; // 1 enables, 0 disables

///////////////////////////////////////////////////////
// begin password protection settings:
///////////////////////////////////////////////////////

// main switch to turn password protection on or off
$C['enable_password_protect'] = 0; // 1 on, 0 off

// note: the password protect settings only matter when password protection is on:

// password protect the whole whose-online page content
// enabling this hides the whole whose-online table to the not-logged in
$C['password_protect_all'] = 0; // 1 enables, 0 disables

///////////////////////////////////////////////////////
// next 5 settings only matter if $C['password_protect_all'] = 0;
///////////////////////////////////////////////////////

// hide autorefresh on the whose-online page from the not-logged in
$C['password_protect_refresh'] = 1;

// hide the select profile display on the whose-online page from the not-logged in
$C['password_protect_profile_display'] = 1; // 1 enables, 0 disables

// hide the ip addresses on the whose-online page from the not-logged in
$C['password_protect_ip_display'] = 1; // 1 enables, 0 disables

// hide the last url on the whose-online page from the not-logged in
$C['password_protect_last_url_display'] = 1; // 1 enables, 0 disables

// hide the referer on the whose-online page from the not-logged in
$C['password_protect_referer_display'] = 1; // 1 enables, 0 disables

/*
-------------------------------------------------------------------
SAMPLE if you only want to request username and password on login form.
Note: usernames and passwords are listed when $C['require_username_password'] = 1;
Each row represents different user.
Delete a row you do not need. Add rows if you need more.

$LOGIN_INFO = array(
'user1' => 'somepassword',
'user2' => 'somepassword2',
);

--------------------------------------------------------------------
SAMPLE if you only want to request password on login form.
Note: only passwords are listed when $C['require_username_password'] = 0;
Each row represents different user.
Delete a row you do not need. Add rows if you need more.

$LOGIN_INFO = array(
'somepassword',
'somepassword2',
);

--------------------------------------------------------------------

Decide if you want to request username and password on login form,
or if you only want to request password on login form.
then set $C['require_username_password'] and configure $LOGIN_INFO according to the SAMPLE above

*/

// username and password? 1 - username and password form, 0 - password form only
$C['require_username_password'] = 1;

// Add login info below, like described in SAMPLE above
// NOTE: all rows must have comma "," at the end of line
$LOGIN_INFO = array(
'admin' => 'somepassword', // change the default 'somepassword' password!!
);
// NOTE: MAKE SURE TO CHANGE THE DEFAULT PASSWORD !

// time out login after NN minutes of inactivity. Set to 0 to not timeout
$C['login_timeout_minutes'] = 0;

// This setting is only useful when $C['login_timeout_minutes'] is not zero
// 1 - reset timeout time from last activity, 0 - timeout time from login
$C['login_timeout_check_activity'] = 1;

///////////////////////////////////////////////////////
// end password protection settings
///////////////////////////////////////////////////////

// use this array for Last URL corrections
// on carterlake templates some of the visitors show thermometer.php instead of index.php
// thermometer.php is a file called from index.php
// add any corrections you need (be careful not to break the array syntax)
$C['last_page_corrections'] = array(
'thermometer.php' => '/index.php',
'settings.php' => '/index.php',
);

// Seconds that a visitor is considered "active"
$C['active_time'] = 300; // 300 seconds is 5 minutes

// Seconds before visitor is removed from display
$C['track_time'] = 900; // 900 seconds is 15 minutes

// Days to store a visitor in whos-online database, default is 30
// used for optional multi view whos-been-online maps (see readme-location-plugin.txt)
$C['store_days'] = 30;

// time format displayed on 'Max users today' and 'Last refresh time'
// 'h:i a T' would be 02:25 pm PST
$C['time_format'] = 'h:i a T'; // see http://us3.php.net/date

// time format displayed on 'Entry' and 'Last Click' time on the whos-online page
// 'h:i:sa' would be 02:25:25pm
$C['time_format_hms'] = 'h:i:sa'; // see http://us3.php.net/date

// date time displayed for month, year, all, time records
// 'm-d-Y h:i a T' would be 12-14-2008 02:25 pm PST
$C['date_time_format'] = 'm-d-Y h:i a T'; // see http://us3.php.net/date

// date displayed for "The GeoLite data was last updated on..."
$C['geoip_date_format'] = 'm-d-Y';

// three of the strings can be auto wordwrapped
$C['lasturl_wordwrap_chars'] = 175; // <= set to number of characters to wrap to
$C['useragent_wordwrap_chars'] = 250; // <= set to number of characters to wrap to
$C['referer_wordwrap_chars'] = 250; // <= set to number of characters to wrap to

// Text colors used for table entries - different colored text for different users
// Named colors and #Hex values should work fine
$C['color_bot'] = 'maroon';
$C['color_admin'] = 'darkblue';
$C['color_guest'] = 'green';

// status image names
// just image names only, do not add any paths
$C['image_active_guest'] = 'active_user.gif'; // active user
$C['image_inactive_guest'] = 'inactive_user.gif'; // inactive user
$C['image_active_bot'] = 'active_bot.gif'; // active bot
$C['image_inactive_bot'] = 'inactive_bot.gif'; // inactive bot

// worldmap image names
// just image names only, do not add any paths
$C['image_worldmap'] = 'wo-worldmap.jpg'; // World (small) do not delete this one, it is the default
$C['image_worldmap_1'] = 'wo-worldmap.jpg'; // World (small) do not delete this one, it is the default
$C['image_worldmap_2'] = 'wo-worldmap-large.jpg'; // World (large)
$C['image_worldmap_3'] = 'wo-us-black-map.png'; // US (black)
$C['image_worldmap_4'] = 'wo-us-brown-map.png'; // US (brown)
$C['image_worldmap_5'] = 'wo-akus-black-map.png'; // Canada and US (black)
$C['image_worldmap_6'] = 'wo-akus-brown-map.png'; // Canada and US (brown)
$C['image_worldmap_7'] = 'wo-asia-black-map.png'; // Asia (black)
$C['image_worldmap_8'] = 'wo-asia-brown-map.png'; // Asia (brown)
$C['image_worldmap_9'] = 'wo-aus-nz-black-map.png'; // Australia and NZ (black)
$C['image_worldmap_10'] = 'wo-aus-nz-brown-map.png'; // Australia and NZ (brown)
$C['image_worldmap_11'] = 'wo-ceu-black-map.png'; // Europe Central (black)
$C['image_worldmap_12'] = 'wo-ceu-brown-map.png'; // Europe Central (brown)
$C['image_worldmap_13'] = 'wo-eu-black-map.png'; // Europe (black)
$C['image_worldmap_14'] = 'wo-eu-brown-map.png'; // Europe (brown)
$C['image_worldmap_15'] = 'wo-fin-black-map.png'; // Finland (black)
$C['image_worldmap_16'] = 'wo-fin-brown-map.png'; // Finland (brown)
$C['image_worldmap_17'] = 'wo-gb-black-map.png'; // Great Britain (black)
$C['image_worldmap_18'] = 'wo-gb-brown-map.png'; // Great Britain (brown)
$C['image_worldmap_19'] = 'wo-mwus-black-map.png'; // US Midwest (black)
$C['image_worldmap_20'] = 'wo-mwus-brown-map.png'; // US Midwest (brown)
$C['image_worldmap_21'] = 'wo-ncus-black-map.png'; // US Upper Midwest (black)
$C['image_worldmap_22'] = 'wo-ncus-brown-map.png'; // US Upper Midwest (brown)
$C['image_worldmap_23'] = 'wo-neus-black-map.png'; // US Northeast (black)
$C['image_worldmap_24'] = 'wo-neus-brown-map.png'; // US Northeast (brown)
$C['image_worldmap_25'] = 'wo-nwus-black-map.png'; // US Northwest (black)
$C['image_worldmap_26'] = 'wo-nwus-brown-map.png'; // US Northwest (brown)
$C['image_worldmap_27'] = 'wo-rmus-black-map.png'; // US Rocky Mountain (black)
$C['image_worldmap_28'] = 'wo-rmus-brown-map.png'; // US Rocky Mountain (brown)
$C['image_worldmap_29'] = 'wo-scus-black-map.png'; // US South (black)
$C['image_worldmap_30'] = 'wo-scus-brown-map.png'; // US South (brown)
$C['image_worldmap_31'] = 'wo-seus-black-map.png'; // US Southeast (black)
$C['image_worldmap_32'] = 'wo-seus-brown-map.png'; // US Southeast (brown)
$C['image_worldmap_33'] = 'wo-swus-black-map.png'; // US Southwest (black)
$C['image_worldmap_34'] = 'wo-swus-brown-map.png'; // US Southwest (brown)
// you can add more, just increment the numbers

$C['image_pin'] = 'wo-pin.jpg'; // do not delete this one, it is the default
$C['image_pin_1'] = 'wo-pin.jpg'; // do not delete this one, it is the default
$C['image_pin_2'] = 'wo-pin5x5.png';
$C['image_pin_3'] = 'wo-pin-green5x5.jpg';
// you can add more, just increment the numbers

// show image pins for bots on the maps?
$C['show_bots_on_worldmap'] = 1;

// HTML maps automatically printed inside tables?
// (this is workaround for an IE problem. The map will be wrapped in a html table)
$C['maps_in_tables'] = 1;

// define who's online page language words
// here you can translate the English words into another language
define('HEADING_TITLE', 'Who\'s Online');
define('TABLE_HEADING_ONLINE', 'Online');
define('TABLE_HEADING_WHO', 'Who');
define('TABLE_HEADING_IP_ADDRESS', 'IP Address');
define('TABLE_HEADING_ENTRY', 'Entry');
define('TABLE_HEADING_LAST_CLICK', 'Last Click');
define('TABLE_HEADING_LAST_URL', 'Last URL');
define('TABLE_HEADING_REFERER', 'Referer');
define('TABLE_HEADING_ACTION', 'Action');
define('TABLE_HEADING_COUNTRY', 'Location');

define('TEXT_LAST_REFRESH', 'Last refresh at');
define('TEXT_EMPTY', 'Empty');
define('TEXT_NUMBER_OF_USERS', 'Visitor(s) online (Considered inactive after 5 minutes. Removed after 15 minutes)');
define('TEXT_HTTP_REFERER_URL', 'HTTP Referer URL');
define('TEXT_YES', 'Yes');
define('TEXT_NO', 'No');

define('TEXT_ACTIVE_GUEST', 'Active Guest');
define('TEXT_INACTIVE_GUEST', 'Inactive Guest');
define('TEXT_INACTIVE_BOT', 'Inactive Bot');
define('TEXT_ACTIVE_BOT', 'Active Bot');

define('TEXT_REFRESH_RATE', 'Refresh Rate');
define('TEXT_PROFILE_DISPLAY', 'Profile Display');
define('TEXT_SHOW_BOTS', 'Show Bots');

define('TEXT_USER_AGENT', 'User Agent');
define('TEXT_HOST', 'Host');
define('TEXT_ERROR', 'Error');
define('TEXT_DUPLICATE_IP', 'Duplicate IP(s)');
define('TEXT_BOTS', 'Bots');
define('TEXT_YOU', 'You');
define('TEXT_ALL', 'All');
define('TEXT_ARE_ACTIVE', ' are active.');

define('TEXT_YOUR_IP_ADDRESS', 'Your IP Address');
define('TEXT_NONE', 'None');
define('TEXT_GUEST', 'Guest');
define('TEXT_GUESTS', 'Guests');
define('TEXT_VISITS', 'visits');

// records language
define('TEXT_VISITORS_ONLINE_NOW', 'Visitors online right now');
define('TEXT_MAX_VISITORS_TODAY', 'Max visitors today');
define('TEXT_THIS_MONTH', 'This month');
define('TEXT_THIS_YEAR', 'This year');
define('TEXT_ALL_TIME', 'All time');
define('TEXT_AT', 'at');

// password protect language
define('TEXT_LOGIN', 'Login');
define('TEXT_LOGOUT', 'Logout');
define('TEXT_USER', 'User');
define('TEXT_PASSWORD', 'Password');
define('TEXT_INVALID_LOGIN', 'Invalid Login');

// geoip language
define('TEXT_LAST_UPDATED', 'The GeoLite data was last updated on');
define('TEXT_DAYS_AGO', 'days ago');
define('TEXT_MIGHT_BE_OUTDATED', 'an update is available');
define('TEXT_CLICK_TO_UPDATE', 'click here to update');
define('TEXT_AGO', 'ago');
define('TEXT_VISITORS_SINCE', 'visitors since');
define('TEXT_MINUTES', 'minutes');
define('TEXT_HOURS', 'hours');
define('TEXT_DAYS', 'days');
define('TEXT_TIME', 'Time');
define('TEXT_UNITS', 'Units');
define('TEXT_GO', 'Go');
define('TEXT_MAP', 'Map');
define('TEXT_VIEW_MAPS', 'View region maps of users that have been online');
define('TEXT_SELECT_TIME', 'Select a time period up to');
define('TEXT_MAXMIND_CREDIT', 'Uses GeoLite data created by MaxMind, available from http://www.maxmind.com/';);

// note if you use European language characters in your language defines and it does not show peoperly on the maps:
// you could try setting up a True Type Font (fonts are not included, you have to get your own)
// optional true type font for the text on the maps (needed to support European language characters)
//$C['map_text_font'] = 'arial.ttf';
//$C['map_text_font'] = 'veramobd.ttf';
// Example: $C['map_text_font'] = 'arial.ttf'
// DO NOT USE UNLESS YOU HAVE arial.ttf file in the same directory as this script!
// Any .ttf font files are supported,
// get free fonts: http://www.google.com/search?hl=en&q=free+ttf+fonts

// no more settings below this line --------------------------------------------

?>

Toevoeging op 26/07/2013 21:40:12:

- Aar - op 26/07/2013 21:20:03

Hoe sla je het op in het tekstbestand?
is een .php-file met een array niet gemakkelijker?


Hoi,

Heb de hele file even geplaats.

Groet,

Piet


Toevoeging op 26/07/2013 21:52:18:

- Aar - op 26/07/2013 21:20:03

Hoe sla je het op in het tekstbestand?
is een .php-file met een array niet gemakkelijker?


Hoi Aar,

Op deze manier komt het in de languane-nl.txt te staan.

langlookup|Visitors online right now|Bezoekers online|

Als de gebruiker van mijn site dan de Nederlandse taal heeft gekozen, word de Engelse tekst "Visitors online right now" vertaal naar "Bezoekers online"

Groet,

Piet
Wat je nu doet, is omslachtig dubbelop: je definieert een constante met een string, maar laat daarop vervolgens een stringfunctie los die de eerder gedefinieerde string vervangt door een nieuwe string.

Dat kan sneller en simpeler door die constante maar één keer te definiëren:

<?php
if ($huidigeTaal == 'nl') {
// Alle constanten voor Nederlands (nl)
define('TEXT_VISITORS_ONLINE_NOW', 'Bezoekers online');
} else {
// Alle constanten voor de standaardtaal Engels (en)
define('TEXT_VISITORS_ONLINE_NOW', 'Visitors online right now');
}
?>

Hetzelfde kan met een include voor een 'language pack' met de constanten per taal, bijvoorbeeld:

<?php
if ($huidigeTaal == 'nl') {
include 'language-nl.txt';
} else {
include 'language-en.txt';
}
?>
Ward van der Put op 27/07/2013 12:28:41

Wat je nu doet, is omslachtig dubbelop: je definieert een constante met een string, maar laat daarop vervolgens een stringfunctie los die de eerder gedefinieerde string vervangt door een nieuwe string.

Dat kan sneller en simpeler door die constante maar één keer te definiëren:

<?php
if ($huidigeTaal == 'nl') {
// Alle constanten voor Nederlands (nl)
define('TEXT_VISITORS_ONLINE_NOW', 'Bezoekers online');
} else {
// Alle constanten voor de standaardtaal Engels (en)
define('TEXT_VISITORS_ONLINE_NOW', 'Visitors online right now');
}
?>

Hetzelfde kan met een include voor een 'language pack' met de constanten per taal, bijvoorbeeld:

<?php
if ($huidigeTaal == 'nl') {
include 'language-nl.txt';
} else {
include 'language-en.txt';
}
?>


Hoi Ward,

Bedank voor de tip/hulp, zal het gaan toepassen/uitproberen.
De php file is niet door mijnzelf gemaakt, maar een bestaande file.

Vr groet,

Piet


Toevoeging op 27/07/2013 13:34:30:

Piet Kampen op 27/07/2013 12:47:47

[quote="Ward van der Put op 27/07/2013 12:28:41"]
Wat je nu doet, is omslachtig dubbelop: je definieert een constante met een string, maar laat daarop vervolgens een stringfunctie los die de eerder gedefinieerde string vervangt door een nieuwe string.

Dat kan sneller en simpeler door die constante maar één keer te definiëren:

<?php
if ($huidigeTaal == 'nl') {
// Alle constanten voor Nederlands (nl)
define('TEXT_VISITORS_ONLINE_NOW', 'Bezoekers online');
} else {
// Alle constanten voor de standaardtaal Engels (en)
define('TEXT_VISITORS_ONLINE_NOW', 'Visitors online right now');
}
?>

Hetzelfde kan met een include voor een 'language pack' met de constanten per taal, bijvoorbeeld:

<?php
if ($huidigeTaal == 'nl') {
include 'language-nl.txt';
} else {
include 'language-en.txt';
}
?>


Hoi Ward,

Bedank voor de tip/hulp, zal het gaan toepassen/uitproberen.
De php file is niet door mijnzelf gemaakt, maar een bestaande file.

Vr groet,

Piet

[/quote]

Hoi Ward,

Heb beide opties uitgeprobeerd, maar het scherm blijft in beide gevallen blanco van de site.

Vr groet,

Piet
Piet Kampen op 27/07/2013 12:47:47

[quote="Ward van der Put op 27/07/2013 12:28:41"]
Wat je nu doet, is omslachtig dubbelop: je definieert een constante met een string, maar laat daarop vervolgens een stringfunctie los die de eerder gedefinieerde string vervangt door een nieuwe string.

Dat kan sneller en simpeler door die constante maar één keer te definiëren:

<?php
if ($huidigeTaal == 'nl') {
// Alle constanten voor Nederlands (nl)
define('TEXT_VISITORS_ONLINE_NOW', 'Bezoekers online');
} else {
// Alle constanten voor de standaardtaal Engels (en)
define('TEXT_VISITORS_ONLINE_NOW', 'Visitors online right now');
}
?>

Hetzelfde kan met een include voor een 'language pack' met de constanten per taal, bijvoorbeeld:

<?php
if ($huidigeTaal == 'nl') {
include 'language-nl.txt';
} else {
include 'language-en.txt';
}
?>


Hoi Ward,

Bedank voor de tip/hulp, zal het gaan toepassen/uitproberen.
De php file is niet door mijnzelf gemaakt, maar een bestaande file.

Vr groet,

Piet


Toevoeging op 27/07/2013 13:34:30:

Piet Kampen op 27/07/2013 12:47:47

[quote="Ward van der Put op 27/07/2013 12:28:41"]
Wat je nu doet, is omslachtig dubbelop: je definieert een constante met een string, maar laat daarop vervolgens een stringfunctie los die de eerder gedefinieerde string vervangt door een nieuwe string.

Dat kan sneller en simpeler door die constante maar één keer te definiëren:

<?php
if ($huidigeTaal == 'nl') {
// Alle constanten voor Nederlands (nl)
define('TEXT_VISITORS_ONLINE_NOW', 'Bezoekers online');
} else {
// Alle constanten voor de standaardtaal Engels (en)
define('TEXT_VISITORS_ONLINE_NOW', 'Visitors online right now');
}
?>

Hetzelfde kan met een include voor een 'language pack' met de constanten per taal, bijvoorbeeld:

<?php
if ($huidigeTaal == 'nl') {
include 'language-nl.txt';
} else {
include 'language-en.txt';
}
?>


Hoi Ward,

Bedank voor de tip/hulp, zal het gaan toepassen/uitproberen.
De php file is niet door mijnzelf gemaakt, maar een bestaande file.

Vr groet,

Piet

[/quote]

Hoi Ward,

Heb beide opties uitgeprobeerd, maar het scherm blijft in beide gevallen blanco van de site.

Vr groet,

Piet
[/quote]

Hoi Ward,

Heb even te hard geroepen, de eerst optie werkt goed.
Sorry.
Alleen als ik de website dan in het Engels zet blijft het vertaalde Nederlands, gaat dus niet terug naar het Engels.

Vr groet,

Piet
Piet Kampen op 28/07/2013 13:51:37
Heb even te hard geroepen, de eerst optie werkt goed.
Sorry.
Alleen als ik de website dan in het Engels zet blijft het vertaalde Nederlands, gaat dus niet terug naar het Engels.

Zoek eens naar het codefragment dat de huidige taal bepaalt. En post die eens even? Daarin kun je vermoedelijk namelijk een variabele of constante terugvinden die je kunt gebruiken om de juiste vertaling te laden.

Ward van der Put op 29/07/2013 08:39:10

[quote="Piet Kampen op 28/07/2013 13:51:37"]Heb even te hard geroepen, de eerst optie werkt goed.
Sorry.
Alleen als ik de website dan in het Engels zet blijft het vertaalde Nederlands, gaat dus niet terug naar het Engels.

Zoek eens naar het codefragment dat de huidige taal bepaalt. En post die eens even? Daarin kun je vermoedelijk namelijk een variabele of constante terugvinden die je kunt gebruiken om de juiste vertaling te laden.


[/quote]

Hoi Ward,

Al met al ben ik niet zo goed thuis in deze materie.
Het gaat hier om een weerwebsite heb er twee draaien.
Een op http://www.meteosauwerd.nl
En de andere waar het omgaat op http://weerstation-sauwerd.nl
In alle php files word gebruik gemaakt van deze opties bij het vertalen:

<?php langtrans ('Visitors online right now'); ?>

of

<?php echo langtransstr ('Visitors online right now'); ?>

In dan word dus de regel "Visitors online right now" op deze manier in de language van Nederland gezet:

langlookup|Visitors online right now|Bezoekers online|

Vaak zijn de site ook nog in meerdere talen (4)
Ik heb het idee dat als je het gaat doen zoals jij aangaf het niet meer werkt.

Als ik dus deze onderstaande regel op de manier kan doen zoals het gebruikelijk is dan is het zeker goed.

define('TEXT_VISITOR_ONLINE_NOW', 'Visitors online right now');

Dus al met al zou voor mij dat de beste oplossin zijn, ook al is het meer werk.

Vr groet,

Piet
Piet, je vervangt een constante met een functie door een andere constante. Dat zijn twee stappen te veel. Je kunt veel beter onmiddellijk uitsluitend de juiste constante met de te gebruiken tekst definiëren.

Daar komt nog bij dat de volgende opzet fouten in de hand werkt:

<?php
// Constante met string definiëren:
define('TEXT_VISITOR_ONLINE_NOW', 'Visitors online right now');
// String vervangen door een vertaling:
echo langtrans('Visitors online right now');
?>

Je kunt hierna namelijk niet meer de tekst wijzigen door slechts één constante aan te passen. In plaats daarvan moet je de constante en elke aanroep van langtrans() gaan vervangen bij een wijziging van de tekst. Niet doen, want het werkt fouten in de hand.
Ward van der Put op 29/07/2013 12:28:58

Piet, je vervangt een constante met een functie door een andere constante. Dat zijn twee stappen te veel. Je kunt veel beter onmiddellijk uitsluitend de juiste constante met de te gebruiken tekst definiëren.

Daar komt nog bij dat de volgende opzet fouten in de hand werkt:

<?php
// Constante met string definiëren:
define('TEXT_VISITOR_ONLINE_NOW', 'Visitors online right now');
// String vervangen door een vertaling:
echo langtrans('Visitors online right now');
?>

Je kunt hierna namelijk niet meer de tekst wijzigen door slechts één constante aan te passen. In plaats daarvan moet je de constante en elke aanroep van langtrans() gaan vervangen bij een wijziging van de tekst. Niet doen, want het werkt fouten in de hand.


Hoi Ward,

Bovenstaande werkt ook niet komt er een foutmelding, wat jij ook al aangaf.
Verder zit ik totaal niet in deze materie zoals ik al zei.

Wat jij eerder aangaf:

Zoek eens naar het codefragment dat de huidige taal bepaalt. En post die eens even? Daarin kun je vermoedelijk namelijk een variabele of constante terugvinden die je kunt gebruiken om de juiste vertaling te laden.

is dus ook onbekend voor mij.

Denk dat het maar zo moet blijven helaas, ook omdat ik mij op een terein begeef waar ik niet in thuis ben helaas.
Had gedacht dat het met wat ik aangaf op te losssen zou zijn, maar nee dus.

Bedankt voor de moeite en tijd die je er in heb gestoken.

Vr groet,

Piet

Piet

Reageren