1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-21 14:22:40 +01:00

Update arcanist to work with more modular translations

Summary:
Ref T7152. Ref T1139.

  - Tweak API.
  - Move translations out of __init__ file.

Test Plan:
  - Ran `arc`.
  - Added a goofy translation and made sure it was working.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7152, T1139

Differential Revision: https://secure.phabricator.com/D11746
This commit is contained in:
epriestley 2015-02-11 13:02:11 -08:00
parent 3f132f4a4e
commit 8f8fe44b05
3 changed files with 70 additions and 54 deletions

View file

@ -51,58 +51,8 @@ if (!@constant('__LIBPHUTIL__')) {
exit(1);
}
PhutilTranslator::getInstance()
->addTranslations(array(
'%s locally modified path(s) are not included in this revision:' => array(
'A locally modified path is not included in this revision:',
'Locally modified paths are not included in this revision:',
),
'These %s path(s) will NOT be committed. Commit this revision '.
'anyway?' => array(
'This path will NOT be committed. Commit this revision anyway?',
'These paths will NOT be committed. Commit this revision anyway?',
),
'Revision includes changes to %s path(s) that do not exist:' => array(
'Revision includes changes to a path that does not exist:',
'Revision includes changes to paths that do not exist:',
),
'This diff includes %s file(s) which are not valid UTF-8 (they contain '.
'invalid byte sequences). You can either stop this workflow and fix '.
'these files, or continue. If you continue, these files will be '.
'marked as binary.' => array(
'This diff includes a file which is not valid UTF-8 (it has invalid '.
'byte sequences). You can either stop this workflow and fix it, or '.
'continue. If you continue, this file will be marked as binary.',
'This diff includes files which are not valid UTF-8 (they contain '.
'invalid byte sequences). You can either stop this workflow and fix '.
'these files, or continue. If you continue, these files will be '.
'marked as binary.',
),
'%d AFFECTED FILE(S)' => array('AFFECTED FILE', 'AFFECTED FILES'),
'Do you want to mark these %s file(s) as binary and continue?' => array(
'Do you want to mark this file as binary and continue?',
'Do you want to mark these files as binary and continue?',
),
'Do you want to amend these %s file(s) to the commit?' => array(
'Do you want to amend this file to the commit?',
'Do you want to amend these files to the commit?',
),
'Do you want to add these %s file(s) to the commit?' => array(
'Do you want to add this file to the commit?',
'Do you want to add these files to the commit?',
),
'%s line(s)' => array('line', 'lines'),
'%d test(s)' => array('%d test', '%d tests'),
'%d assertion(s) passed.' => array(
'%d assertion passed.',
'%d assertions passed.',
),
));
phutil_load_library(dirname(dirname(__FILE__)).'/src/');
PhutilTranslator::getInstance()
->setLocale(PhutilLocale::loadLocale('en_US'))
->setTranslations(PhutilTranslation::getTranslationMapForLocale('en_US'));

View file

@ -184,6 +184,7 @@ phutil_register_library_map(array(
'ArcanistTextLinterTestCase' => 'lint/linter/__tests__/ArcanistTextLinterTestCase.php',
'ArcanistTimeWorkflow' => 'workflow/ArcanistTimeWorkflow.php',
'ArcanistTodoWorkflow' => 'workflow/ArcanistTodoWorkflow.php',
'ArcanistUSEnglishTranslation' => 'internationalization/ArcanistUSEnglishTranslation.php',
'ArcanistUncommittedChangesException' => 'exception/usage/ArcanistUncommittedChangesException.php',
'ArcanistUnitConsoleRenderer' => 'unit/renderer/ArcanistUnitConsoleRenderer.php',
'ArcanistUnitRenderer' => 'unit/renderer/ArcanistUnitRenderer.php',
@ -367,6 +368,7 @@ phutil_register_library_map(array(
'ArcanistTextLinterTestCase' => 'ArcanistLinterTestCase',
'ArcanistTimeWorkflow' => 'ArcanistPhrequentWorkflow',
'ArcanistTodoWorkflow' => 'ArcanistWorkflow',
'ArcanistUSEnglishTranslation' => 'PhutilTranslation',
'ArcanistUncommittedChangesException' => 'ArcanistUsageException',
'ArcanistUnitConsoleRenderer' => 'ArcanistUnitRenderer',
'ArcanistUnitTestableLintEngine' => 'ArcanistLintEngine',

View file

@ -0,0 +1,64 @@
<?php
final class ArcanistUSEnglishTranslation extends PhutilTranslation {
public function getLocaleCode() {
return 'en_US';
}
protected function getTranslations() {
return array(
'%s locally modified path(s) are not included in this revision:' => array(
'A locally modified path is not included in this revision:',
'Locally modified paths are not included in this revision:',
),
'These %s path(s) will NOT be committed. Commit this revision '.
'anyway?' => array(
'This path will NOT be committed. Commit this revision anyway?',
'These paths will NOT be committed. Commit this revision anyway?',
),
'Revision includes changes to %s path(s) that do not exist:' => array(
'Revision includes changes to a path that does not exist:',
'Revision includes changes to paths that do not exist:',
),
'This diff includes %s file(s) which are not valid UTF-8 (they contain '.
'invalid byte sequences). You can either stop this workflow and fix '.
'these files, or continue. If you continue, these files will be '.
'marked as binary.' => array(
'This diff includes a file which is not valid UTF-8 (it has invalid '.
'byte sequences). You can either stop this workflow and fix it, or '.
'continue. If you continue, this file will be marked as binary.',
'This diff includes files which are not valid UTF-8 (they contain '.
'invalid byte sequences). You can either stop this workflow and fix '.
'these files, or continue. If you continue, these files will be '.
'marked as binary.',
),
'%d AFFECTED FILE(S)' => array('AFFECTED FILE', 'AFFECTED FILES'),
'Do you want to mark these %s file(s) as binary and continue?' => array(
'Do you want to mark this file as binary and continue?',
'Do you want to mark these files as binary and continue?',
),
'Do you want to amend these %s file(s) to the commit?' => array(
'Do you want to amend this file to the commit?',
'Do you want to amend these files to the commit?',
),
'Do you want to add these %s file(s) to the commit?' => array(
'Do you want to add this file to the commit?',
'Do you want to add these files to the commit?',
),
'%s line(s)' => array('line', 'lines'),
'%d test(s)' => array('%d test', '%d tests'),
'%d assertion(s) passed.' => array(
'%d assertion passed.',
'%d assertions passed.',
),
);
}
}