[RO]
În acest topic vă voi îndruma să vă puteți seta numele categoriilor, forumurilor și descrierea lor în doua limbi diferite.
De ce avem nevoie?:
[EN]
Why do we need it?:
[RO]Deschidem includes/functions.php și adăugăm jos de tot următoarea funcție ce ne ajută sa modificam numele forumului în cele doua limbi.
[EN]We open includes/functions.php and add the following function at the bottom that helps us change the forum name in the two languages.ATENȚIE!!! În funcția scrisă mai sus, limba default este româna și cea de a doua este engleza, le schimbați după bunul plac utilizând coduș ISO al limbii.
ATTENTION!!! In the function written above, the default language is Romanian and the second is English, change them as you wish using the ISO code of the language.
[RO](Atenție sunt de două ori)Deschidem includes/functions_display.php si căutam:
[EN](Be careful, it's twice) Open includes/functions_display.php and search for:[RO]Înlocuim cu:
[EN]Replace with:[RO]Căutam:
[EN]Find:[RO]Înlocuim cu:
[EN]Replace with:[RO]Căutăm:
[EN]Replace with:[RO]Înlocuim cu:
[EN]Replace with:[RO]Căutăm:
[EN]Find:[RO]Înlocuim cu:
[EN]Replace with:[RO]Deschidem includes/functions_content.php și căutăm:
[EN]We open includes/functions_content.php and search for:[RO]Înlocuim cu:
[EN]Replace with:[RO]Deschidem viewtopic.php și cătuăm:
[EN]We open viewtopic.php and search for:[RO]Înlocuim cu:
[EN]Replace with:[RO]Căutăm:
[EN]Find:[RO]Înlocuim cu:
[EN]Replace with:[RO]Deschidem viewforum.php și căutăm:
[EN]We open viewforum.php and search for:[RO]Înlocuim cu:
[EN]Replace with:[RO]Deschidem posting.php și cătuăm:
[EN]We open posting.php and search for:[RO]Înlocuim cu:
[EN]Replace with:[RO]Căutăm:
[EN]Find:[RO]Înlocuim cu:
[EN]Replace with:[RO]Deschidem memberlist.php și căutăm:
[EN]We open memberlist.php and search for:[RO]Înlocuim cu:
[EN]Replace with:[RO]
După ce ați finalizat și încărcat fișierele noi în host, atunci când creați sau modificați un forum, structura este următoarea și pentru nume și pentru descriere:
Demo: Link
Funcția respectivă nu generează nici un fel de eroare și nu încetinește funcționalitatea forumului. Dezavantajul este că în cazul unui update, trebuie să rescrieți din nou liniile de cod.
Cine dorește, se poate inspira din codul respectiv ca să creeze o extensie, singura regulă să ne fie adăugată locul de unde s-a inspirat cu codurile, adică forum.itandwebsolutions.ro
[EN]
After you have completed and uploaded the new files to the host, when you create or modify a forum, the structure is as follows for both the name and the description:
Created by: forum.itandwebsolutions.ro
Demo: Link
The respective function does not generate any kind of error and does not slow down the forum's functionality. The disadvantage is that in the case of an update, you have to rewrite the code lines again.
Anyone who wants to can be inspired by the respective code to create an extension, the only rule is to add the place where the codes were inspired from, i.e. forum.itandwebsolutions.ro
Inspired by a MOD 3.0.x viewtopic.php?f=70&t=2231436
În acest topic vă voi îndruma să vă puteți seta numele categoriilor, forumurilor și descrierea lor în doua limbi diferite.
De ce avem nevoie?:
- includes/functions.php
- includes/funcitons_display.php
- includes/functions_content.php
- viewforum.php
- viewtopic.php
- posting.php
- memberlist.php
- Extensia phpBB Select Language: link (ajută la schimbarea rapidă a limbi forumului atât pentru utilizatori cât și pentru vizitatori)
[EN]
Why do we need it?:
- includes/functions.php
- includes/funcitons_display.php
- includes/functions_content.php
- viewforum.php
- viewtopic.php
- posting.php
- memberlist.php
- phpBB Select Language extension: link (helps to quickly change the forum language for both users and visitors)
[RO]Deschidem includes/functions.php și adăugăm jos de tot următoarea funcție ce ne ajută sa modificam numele forumului în cele doua limbi.
[EN]We open includes/functions.php and add the following function at the bottom that helps us change the forum name in the two languages.
Code:
// Funcție multilingv forumuri și descriere # Multilingual forums and description feature // Creat de forum.itandwebsolutions.ro # Created by forum.itandwebsolutios.rofunction get_text_for_language($input, $lang = null){ global $user; // Obținem obiectul global $user # Get the global $user object // Dacă nu se transmite limba explicit, o determinăm # If the language is not passed explicitly, we determine it if ($lang === null) { if (!empty($user->lang_name)) { $lang = $user->lang_name; // Limba selectată de utilizator (inclusiv vizitator) # Language selected by the user (including visitor) } else { $lang = 'ro'; // Limba implicită, română # Default language, Romanian } } $delimiter = '#'; $languages = ['ro', 'en']; // Limbi suportate # Supported languages $forum_names = explode($delimiter, $input); // Verificăm dacă există variante pentru toate limbile # We check if there are variants for all languages if (count($forum_names) == count($languages)) { $i = array_search($lang, $languages); if ($i !== false) { return $forum_names[$i]; // Returnăm varianta potrivită # We return the correct version. } } // Dacă nu există traduceri disponibile, returnăm textul original # If no translations are available, we return the original text return $input;}
ATTENTION!!! In the function written above, the default language is Romanian and the second is English, change them as you wish using the ISO code of the language.
[RO](Atenție sunt de două ori)Deschidem includes/functions_display.php si căutam:
[EN](Be careful, it's twice) Open includes/functions_display.php and search for:
Code:
'FORUM_NAME' => $row['forum_name'],'FORUM_DESC' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']),
[EN]Replace with:
Code:
'FORUM_NAME' => get_text_for_language($row['forum_name']),'FORUM_DESC' => get_text_for_language(generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options'])),
[EN]Find:
Code:
'BREADCRUMB_NAME' => $parent_name,
[EN]Replace with:
Code:
'BREADCRUMB_NAME' => get_text_for_language($parent_name),
[EN]Replace with:
Code:
'BREADCRUMB_NAME' => $forum_data_ary['forum_name'],
[EN]Replace with:
Code:
'BREADCRUMB_NAME' => get_text_for_language($forum_data_ary['forum_name']),
[EN]Find:
Code:
'FORUM_NAME' => $forum_data_ary['forum_name'],'FORUM_DESC' => generate_text_for_display($forum_data_ary['forum_desc'], $forum_data_ary['forum_desc_uid'], $forum_data_ary['forum_desc_bitfield'], $forum_data_ary['forum_desc_options']),
[EN]Replace with:
Code:
'FORUM_NAME' => get_text_for_language($forum_data_ary['forum_name']),'FORUM_DESC' => generate_text_for_display($forum_data_ary['forum_desc'], $forum_data_ary['forum_desc_uid'], $forum_data_ary['forum_desc_bitfield'], $forum_data_ary['forum_desc_options']),
[EN]We open includes/functions_content.php and search for:
Code:
'FORUM_NAME' => $row['forum_name'],
[EN]Replace with:
Code:
'FORUM_NAME' => get_text_for_language($row['forum_name']),
[EN]We open viewtopic.php and search for:
Code:
'FORUM_NAME' => $topic_data['forum_name'],
[EN]Replace with:
Code:
'FORUM_NAME' => get_text_for_language($topic_data['forum_name']),
[EN]Find:
Code:
'L_RETURN_TO_FORUM' => $user->lang('RETURN_TO', $topic_data['forum_name']),
[EN]Replace with:
Code:
'L_RETURN_TO_FORUM' => $user->lang('RETURN_TO', get_text_for_language($topic_data['forum_name'])),
[EN]We open viewforum.php and search for:
Code:
$page_title = $forum_data['forum_name'] . ($start ? ' - ' . $user->lang('PAGE_TITLE_NUMBER', $pagination->get_on_page($config['topics_per_page'], $start)) : '');
[EN]Replace with:
Code:
$page_title = get_text_for_language($forum_data['forum_name']) . ($start ? ' - ' . $user->lang('PAGE_TITLE_NUMBER', $pagination->get_on_page($config['topics_per_page'], $start)) : '');
[EN]We open posting.php and search for:
Code:
'FORUM_NAME' => $post_data['forum_name'],
[EN]Replace with:
Code:
'FORUM_NAME' => get_text_for_language($post_data['forum_name']),
[EN]Find:
Code:
'forum_name' => $post_data['forum_name'],
[EN]Replace with:
Code:
'forum_name' => get_text_for_language($post_data['forum_name']),
[EN]We open memberlist.php and search for:
Code:
$forums[$row['forum_id']] = $row['forum_name'];
[EN]Replace with:
Code:
$forums[$row['forum_id']] = get_text_for_language($row['forum_name']);
După ce ați finalizat și încărcat fișierele noi în host, atunci când creați sau modificați un forum, structura este următoarea și pentru nume și pentru descriere:
- Nume forum: Română#Engleză
- Descriere forum: Descriere#Description.
- Simbolul "#" este pentru separație atât în nume cât și în forum.
Demo: Link
Funcția respectivă nu generează nici un fel de eroare și nu încetinește funcționalitatea forumului. Dezavantajul este că în cazul unui update, trebuie să rescrieți din nou liniile de cod.
Cine dorește, se poate inspira din codul respectiv ca să creeze o extensie, singura regulă să ne fie adăugată locul de unde s-a inspirat cu codurile, adică forum.itandwebsolutions.ro
[EN]
After you have completed and uploaded the new files to the host, when you create or modify a forum, the structure is as follows for both the name and the description:
- Forum name: Romanian#English
- Forum description: Description#Description.
- The "#" symbol is for separation both in the name and in the forum.
Created by: forum.itandwebsolutions.ro
Demo: Link
The respective function does not generate any kind of error and does not slow down the forum's functionality. The disadvantage is that in the case of an update, you have to rewrite the code lines again.
Anyone who wants to can be inspired by the respective code to create an extension, the only rule is to add the place where the codes were inspired from, i.e. forum.itandwebsolutions.ro
Inspired by a MOD 3.0.x viewtopic.php?f=70&t=2231436
Statistics: Posted by KenTSA — Sun Jan 19, 2025 6:34 pm