Jump to content

MilenKo

Members
  • Posts

    466
  • Joined

  • Last visited

Everything posted by MilenKo

  1. Hello guys. I've decided to get brave and start my first delayed output profile for a remake of my knowledge sharing profile. It went all.good so far but I decided to make it multilingual as to fit the users needs. For starters, added a field named: image_single and limited the input to one image as this would be used for the logo. Added.the markup to allow the front end editing (method D or direct edit tag to the <img>. After double clicking on the image, I see the pop-up showing up for a second and then closes. As far as there are no errors in the logs, I am a bit stuck to find the reason. I've read earlier that some users had issues with multilingual fields but could not find anything to point me to the right direction. Any ideas or suggestions?
  2. As always a fast and efficient reply. I never thought of looking for a release notes module, but it is a great addition. Thanks guys!
  3. Hey guys, It was hard not to notice the often updates of this AMAZIN' module and I was wondering if there is a changelog where I could read more about it before deciding to do an upgrade?
  4. Thanks again, @Macrura Will give the module a try and will see how can I fit it in one of my next projects. Thanks to you and @pmarki for the idea and the code.
  5. I see Macrura. I would watch closely the development of your mod, however, the options and setups seems sort of way too much for the purpose of my simple projects that hold a logo, few text fields etc. At least I got on the right track using a settings page to hold general variables
  6. Hello all. I was wondering about the use of this module and would like to check for your opinion, guys, before I start testing it. Presently I setup manually a simple page where all my general site settings fields resign (Settings) with no template assigned on it. After that I define a variable $settings (could be a name of your preference ) in _init.php $settings = $pages->get('/settings/'); // Grab the page url and add it here or $settings = $pages->get(settings_page_id); // Grab the page ID and add it here After that, I am able to print any field value in the markup by using: echo $settings->fied_name // text and integer value fields or echo $settings->some_image_field->first->size(X,Y)->url // Just an example for images etc. For sure the limit is the API of PW for any field and the parameters with it. So my wondering is would the use of the module give more functionality as of the present setup? Bear in mind, that for a few clients I already setup the access to Settings page and they can change anything that is there or provide access to somebody else using PW user permissions options. The Settings page can hold all sorts of PW fields available + custom ones that you've created/added and text and text area has absolutely no issues being multilanguage. Respect to the mod development team for the time and efforts for sure, I am just trying to figure out the benefits of use over the present setup.
  7. No issues with me either, I just started a new profile with 3.0.98 and latest AOS and all works fine, I can switch languages from admin etc.
  8. @Juergen Thanks for the shared custom mystyles.js . I was wondering what else I could add to the editor to make the life of my friend easier when adding his content and found quite a few useful ideas even though my project is under Bootstrap but not uikit yet (the last one is in a process of learning )
  9. @tpr Thank you for that helpful info. I am still learning project after project. @neosin Thank you for the alternative solution as well. For sure I could use it for some other projects, but in this one the idea was to provide an easy way to my friend to edit the translations without asking me to mess with the code once the project is finished. This is what I love in ProcessWire - the elasticity of accomplishing the things in so many different ways - where the sky is the limit and it is up to the devs to decide which way to get the things done.
  10. Hey guys, seems like my joy was not that long.. As soon as I started working the inner pages of my project I noticed that the function translate('smth' , 'General') is giving me the error I've seen previously: Call to undefined function translate() Having reviewed my posts previously, I dully noted that I forgot to add the <?php namespace ProcessWire; at the beginning of my inner pages templates. So if you happen to fall in my situation, make sure to have your namespace set to avoid my early morning big eyes
  11. It works perfectly fine now. And yes, @theo it worked with Bootstrap and uikit. Thanks again. I guess I could do the same exercise for styling ordered and unordered lists, block quotes etc.
  12. Thank @theo . That is what I added to my CSS, however I forgot the fact that CKEditor is not inserting the class automatically so I will have to add the classes using myclass.js approach. Let me see how would that work out,
  13. Thanks, @szabesz . Initially I thought it would need some styling for the output, however I was mislead by the appearance of the content inside the editor and thought that I am not doing something properly. Your suggestion seems to be quite easy doable however I should just match the proper classes for bootstrap as I don't use uikit on this project.
  14. Hello guys. I feel a bit ashamed of this fact but I just needed to add an image with some text wrapped around it using CKEditor and I simply can't achieve that. I have an image field attached to the template (called images) and it is showing promptly the uploaded images. I am able to manipulate the image and I set its alignment to left side. Then I add some text and I can see in CKEditor that the text is properly surrounding the image. However, once I save the page and view it, it shows the text under the image or only a line is staying asside the image and the rest is under the image again. As far as the field used for the text (body) is set to TextMultiLang and I did not added any text formatters and chose the content type to be HTML/Markup. In my CSS I've added some of the PW styles for the alignement as per some posts here but that did not help either. Something I am missing again?
  15. Well after your reading I went back to suggest to the "customer" who is a close friend of mine and shared the reading. So now we agreed to have the language names versus the flags or even add a dropdown box listing some countries that speak the selected languages. Thanks again for the sharing.
  16. @ottogal Thank you for the impressive reading. Will redo my language selector keeping the flag as the customer requested it, but will also put the language name so that it is clear what language is used. And yes, I will make sure that every language name is written as per the country standard.
  17. Hello. I just decided today to get rid of the language names and use flags for a project of mine and got the same issue mentioned by @Friedrich and @BitPoet after setting my languages to Bulgarian (default), English and Russian. For both - the Russian and English language the icon shows promptly, however only for the Bulgarian one (most likely for the default one) the url does not point to the file but to the folder with the language ID (in my case: site/assets/files/1010 To make the image working, I had to modify a bit the code to check if the language is Bulgarian and add the file name: <?php // Showing the language flags // remember what language is set to $savedLanguage = $user->language; $icon = ''; echo "<span style='margin-left:34px;'>"; foreach($languages as $language) { // if user is already viewing the page in this language, skip it if($language->id == $savedLanguage->id) continue; // if this page isn't viewable (active) for the language, skip it if(!$page->viewable($language)) continue; // set the user's language, so that the $page->url and any other // fields we access from it will be reflective of the $language $user->language = $language; // ID 1010 is of my Bulgarian (problematic language) if($language->id == '1010' ) { $icon = $language->lang_flag->url . "bulgaria.png"; } else { $icon = $language->lang_flag->url; } // output a link to this page in the other language echo "<span style='margin-left:10px;'><a href='$page->url'><img src='{$icon}'></a></span>"; } echo "</span>"; // restore the original language setting $user->language = $savedLanguage; ?> Has anyone had a similar case and found some more elegant solution than checking for the language ID and manually assigning the file name after $lang_flag->url ?
  18. Hello all. I just tried to upgrade an existing profile from 3.0.95 to 3.0.96 and noticed similar behavior as it was mentioned by @theo and @Hackasacka . The upgrade was working perfectly fine on my local server and hosting, however now trying to upgrade automatically the core led me to a folder 'wire' and 'wire-3.0.96' (where 3.0.95 should be the old backup). Strange enough, this only happens with the core of PW but all other modules work just fine. I will proceed to upgrade this one manually and try to do another automated upgrade on next release to see how it would behave. P.S. Manual upgrade works perfectly fine and all I had to do was to extract from the latest version archive the wire, install.php and .htaccess and after a backup of the existing ones to place them in the root domain folder. Tested the frontend and backend - all seems to be fine and the module reports no newer upgrades.
  19. Thanks to @tpr and @ryan I have played a bit with the translation and singular/pluriel and made them working with HTML code inside while using a single file holding all translations and the content of it being commented. Here are the functions I am using that need to simply be added to _func.php (or other file used for calling the custom functions and included_once in _init.php): <?php namespace ProcessWire; /** * /site/templates/_func.php * * This file is currently included by _init.php * Which on the other side is prepended in config.php * */ // _strings.php function call // Example: echo translate('text_string'); // Make sure to add the translation in Setup>Languages>LANGUAGE_NAME function translate($text, $context = 'General', $textdomain = '/site/templates/_strings.php') { return html_entity_decode(_x($text, $context, $textdomain)); } // Singular/plural nouns iteration // Example: echo pluriel('<i> year</i>', '<b> years</b>', 2) // Make sure to add the translation in Setup>Languages>LANGUAGE_NAME with the HTML in it (as needed) function pluriel($singular, $plural, $count) { return html_entity_decode(translate(_n($singular, $plural, $count))); } Now I can have some complex language strings containing html code and would avoid splitting the translation lines to chunks etc. <?php echo translate('Made with <i style="color: #FF0000;" class="fa fa-heart"></i> by <a href="http://processwire.com">ProcessWire</a>') . " - 11 " . pluriel('<i> year</i>', '<b> years</b> ago', 11) . "</a>"; ?> by simply adding the following line to my _strings.php: _x('Made with <i style="color: #FF0000;" class="fa fa-heart"></i> by <a href="http://processwire.com">ProcessWire</a>') . " - 11 " . pluriel('<i> year</i>', '<b> years</b> ago', 11) . "</a>"', 'General'); How cool is that
  20. @tpr Adding your code to _init.php fixed the error. The strange thing is that my _strings.php is located in the same folder as _init.php (/templates/) and I guess it must have had the correct path if the footer was working but strange thing happened and now everything seems to be fine. I tried to change the include code to this: include_once("_strings.php"); and it also worked fine. Seems like the trailing slash was messing up the things. Thank you very-very-very much, again! P.S. What is strange enough, after changing the code to your suggestion and then reverting it back to the standard include: // Shared functions include_once("./_func.php"); // Translation strings include_once("./_strings.php"); made the site working just fine. As far as there is no cache enabled on templates, is it possible that I had to take some steps after changing the path to _strings.php from /templates/languages/ to just /templates/ ?
  21. Nope. As far as I am using direct output, footer.php is just some html markup with php code inserted where needed. Tried adding it, but still see the same error like _t function is not declared...
  22. @tpr I must have missed your message but have came to the same result while inspecting the _init.php and _strings.php I've added the php opening and the page looks OK. Now I got another issue - when I try to browse another page (other than home) I get this error: Call to undefined function _t(), did you mean _()? I tripple checked and yes, my _init.php contains: // Shared functions include_once("./_func.php"); // Translation strings include_once("./_strings.php"); I checked my config.php file to make sure _init.php is prepended and it is: $config->prependTemplateFile = '_init.php'; My _func.php contains: <?php namespace ProcessWire; //_strings.php function call function _t($text, $context = 'General', $textdomain = '/site/templates/_strings.php') { return _x($text, $context, $textdomain); } And my _strings.php file contains; <?php /******************************************* Intentionally commented out // Footer.php _x('CONTACT INFO', 'General'); _x('COMPANY LINKS', 'General'); _x('ABOUT US', 'General'); // About.php _x('OUR HISTORY & FACTS', 'General'); _x('LEADER IN THE REAL ESTATE MARKET SALES SINCE', 'General'); _x('GET A QOUTE', 'General'); //Services.php _x('Our Services', 'General'); *******************************************/ The call of the function in the markup is like this: <?php echo _t('ABOUT US');?> The thing I don't understand is how come the same call in home template works fine for footer but not for other templates.. Something I am missing but what it is... That is the question P.S. If I use __('blabla') - it works fine, but am trying to centralize the translation and avoid repetetive phrases etc.
  23. Well I am sure that it is commented and tried to recreate the file several times. Here is the content of it: /* // Footer.php _x('CONTACT INFO', 'Generic'); _x('COMPANY LINKS', 'Generic'); _x('ABOUT US', 'Generic'); // About.php _x('OUR HISTORY & FACTS', 'Generic'); _x('LEADER IN THE REAL ESTATE MARKET SALES SINCE', 'Generic'); _x('GET A QOUTE', 'Generic'); */ That is what questioned me, why I see the comments in the header and that messes up the divs etc., however as soon as I remove the include it works if I manually add the file path for translation. I checked for some bizzaire code in the header but it is all good there so no explanation why would commented block appear...
  24. Hello guys. I just found this topic while searching for a smarter way to translate the whole site using a single file instead of having repetitive translations in different templates. Tried to reproduce @tpr and @felic approach of using strings file but things got messed up. If I add: // Translation strings include_once("./_strings.php"); to my _init.php that is prepended in the config.php I am seeing the content of the file in my header As far as I remove the include from _init.php all the styles come back promptly. Trying to figure out what is wrong with the setup that worked for others, I decided to remove the include from _init.php again and add manually the strings.php file by going to the language administration and from there after clicking on Find Files To Translate I clicked on Enter file to translate at the bottom and added manually the path to my language file: /sites/templates/languages/strings.php After that I went back to the language translation and added my strings and voila, it all started working promptly. Now this raises a few questions for me: 1. What am I doing wrong to see the include in the header? 2. Do the include of strings.php in _init.php only allowing the file to be automatically found and listed in the translation files or there is another purpose? 3. Is is OK to leave the translation files out of the _init.php and add it manually during the profile work or there are some drawbacks I am not seeing yet?
  25. Thank you @Zeka and @kongondo It seems as it was my mistake of having enabled Other active languages of the menu after I have added the pages and for some reason the language got the same in both. After disabling the option and reenabling it, I got the tabs for Default and English language texts so it is all good now and switching properly. So to say, it is all working fine for multilanguage site out of the box as far as the person has taken the following steps: 1. Figure out the options array and apply the proper styling to the menu. 2. While rendering the menu, do not call the menu by name but use ID as the simplest thing to do (grab the URL from the menu edit link - id=XXXX where xxxx is the ID. In the instructions it was saying to call the menu using: $menu = $modules->get('MarkupMenuBuilder');// $menu is an example echo $menu->render('XXXX', $options); However thanks to the community and the knowledge sharing here, I figured out how to fix it using the following: $menu = $modules->get('MarkupMenuBuilder');// $menu is an example echo $menu->render(XXXX, $options); 4. In order to enable multilanguage options, just go to Setup>Menu Builder. From there while creating or selecting an already created menu, click on the Settings tab and enable the languages you would like the menu to be translated to from the: Other languages for this menu option. Once this step is completted, every menu option would have separate tabs for every language selected. 5. Test the menu pointing to the website url in different languages, ex. /en/ , /ru/ , /de/ etc.
×
×
  • Create New...