HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Tutorial: How to change wording, How to change text, How to change language. How to change locale

13»

Comments

  • Hey guys! Sorry for having to upload this but I have a crucial issue with translations, exactly with one phrase. I don't know how to translate this one and I tried that (obviously worong). Thanks in advance!

    $Definition['EmbededDiscussionLinkText', 'Read the full story here'] = 'EmbededDiscussionLinkText', 'MyTranslate';

  • R_JR_J Admin

    @Deprecatedz said:
    Hey guys! Sorry for having to upload this but I have a crucial issue with translations, exactly with one phrase. I don't know how to translate this one and I tried that (obviously worong). Thanks in advance!

    $Definition['EmbededDiscussionLinkText', 'Read the full story here'] = 'EmbededDiscussionLinkText', 'MyTranslate';

    Use it like that: $Definition['EmbededDiscussionLinkText'] = 'MyTranslate';

  • Is not working :3 . I tried a lot of combinations, I'm starting with Vanilla scripting...

  • R_JR_J Admin

    In which file do you have it?
    Have you deleted the /cache/*.ini files?

  • I put in my site_core.php, and yes every cache is refreshed :'( I don't know how to translate this

  • edited May 2015

    SOLVED:

    $Definition['EmbededDiscussionFormat'] = '<div class="EmbeddedContent">{Image}<strong>{Title}</strong>
    <p>{Excerpt}</p>
    <p><a href="{Url}">**MY TRAD HERE**</a></p><div class="ClearFix"></div></div>';
    

    Yeah! It works like that. (BUT I don't know how cache works, actually I can't change it again :s)

  • R_JR_J Admin

    You should have read the documentation ;)

    @peregrine said:
    the easiest way to change definitions is via /conf/locale.php

    you could change your /conf/locale.php by adding definitions to it.

    e.g.

    ~~~
    <?php if (!defined('APPLICATION')) exit();
    $Definition['%s comment']='%s post';
    $Definition['%s comments']='%s posts';

    @peregrine said:

    Precedence of definition type files

    the precedence is as follows for definitions

    you change or add a definition in one of the following files
    

    the order of locales (the higher the number on the list, the higher precedence).

    en-CA is a country code (substitute your own country code that you use

    ~~~

    1 - application based and dashboard based definitions
    applications/locale/en-CA/definitions.php
    applications/dashboard/locale/en-CA/definitions.php
    2- plugin based - plugins/yourplugin/locale/en-US.php
    plugins/your plugin/locale/en-US/definitions.php
    3 - theme based - themes/yourtheme/locale/en-CA.php
    4 - locale based - /locales/en-US/definitions.php
    5 - locale based locales/en-US/other_definitions.php
    6- conf based - conf/locale.php
    7- conf - specialized conf/locale-en-US.php 
    

    There is at no place the advice to use the LocaleDeveloper results as your final translation files. I personally do not know if you can go that way, but I think you shouldn't try it out when the advice here is to use other ways.

  • @R_j I do not get this can you help me? I think you know what I'm trying to do.

  • @leenguyen0999

    Welcome to the community.

    What is it you can't find?

    You have to create the file locale.php in the conf folder, and then add the translations.

  • RiverRiver MVP
    edited July 2016

    General installation of language specific locales.

    • Download the locale you want from the Addon Directory.
    • Upload the folder to your locales folder.
    • In the Dashboard, go to Locales option
    • Enable the locale.

      repeat the above steps for all the languages you want.

      you can download multiple locales and use the Multilingual plugin or any of the other plugins that support multiple languages.

      then after you enable all the locales you want via the dashboard locales option, choose a default option on the dashboard locales screen and save it.

    You will notice for all locales you installed , there is a Locale: xx in the dashboard for each locale to the left of the locale description in the dashboard for each locale.

    The xx is the name of the locale. It may be ru for russian, de for german, it for italian, and so on.

    This is the same name that appears in the definitions.php in the downloaded locale.

    lets say you downloaded the proper language folder these are locate here in add-ons locales. You may have multiple choices lets say you wanted german. you might see 2 or 3 add-ons. Choose the most recent one which generally says "official" in the description. The official locales are properly named and has Staff authorship in the addon section, they integrate well with vanilla.
    Vanilla forums does a great job with locales. And there is alot of flexibility.

    e.g. after downloading the proper german addon https://vanillaforums.org/addon/vf_de-locale

    in definitions.php of the /vf-de folder

    you will see

    <?php

    $LocaleInfo['vf_de'] = array (
    'Locale' => 'de', // THIS IS THE REFERENCE TO HELP YOU.
    'Name' => 'Deutsch / German',
    'EnName' => 'German',
    'Description' => 'Official German language translations for Vanilla. Help contribute to this translation by going to its translation site here.',
    'Version' => '2016.07.22p1100',
    'Author' => 'Vanilla Community',
    'AuthorUrl' => 'https://www.transifex.com/projects/p/vanilla/language/de/',
    'License' => 'CC BY-SA 4.0',
    'PercentComplete' => 98,
    'NumComplete' => 2187,
    'DenComplete' => 2228,
    'Icon' => 'de.png',
    );

    the 'Locale' => 'de', is the name that appears in dashboard Locale: xx or Locale: de

    this is the same name that appears in you config on the right hand side after you enable the 'Name' => 'Deutsch / German'

    $Configuration['EnabledLocales']['vf_de'] = 'de';

    so the right hand side is "de".

    therefore you can use xx.php where xx is the 'Locale' name in the definitions (and the right had side of enabled locales in config.php).

    de.php in the locales in your plugin folders.

    If you want to override a translation of a plugin, or an application, or a locale EVERYWHERE for all languages you can create a conf/locale.php as specified in the discussion and comments above.

    BUT if you want to override a specific language locale but not others. For example if you want to override the Russian locale with your own Russian substitutes and override the German translations with your own German substitutes and your Italian translation with your own Italian substitutes.

    conf/locale-xx.php files. where xx is the language 'Locale' (see above).

    and you can use conf/locale-de.php in your conf file if you want to override just a portion of the german locale but not affect any other language.

    so you could have

    $Configuration['EnabledLocales']['vf_de'] = 'de';
    $Configuration['EnabledLocales']['vf_it'] = 'it';
    $Configuration['EnabledLocales']['vf_ru'] = 'ru';

    so in your conf folder you might have 3 locales files to specifically override each language.

    /conf/locale-de.php
    /conf/locale-it.php
    /conf/locale-ru.php

    Enabling locales and setting defaults should update the cache files. But if you add a locale file to a plugin, an app, or or the conf file, etc. BEST to Delete the .ini files since this will cause a re-read and add in any files you may have created.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • RiverRiver MVP
    edited July 2016

    if you use multilingual type of plugin.
    obviously if you only want to change(override) english specific translations but leave the other languages translations as is (you would not want /conf/locale.php) but ....

    you would add a /conf/locale-en.php

    since en is the default locale with vanilla out of the box.

    see top discussion for precedence of locale files.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

Sign In or Register to comment.